Newer
Older
const Webpack = require('webpack')
piotr.kupczyk@id.ethz.ch
committed
const HtmlWebpackPlugin = require('html-webpack-plugin')
piotr.kupczyk@id.ethz.ch
committed
const CopyWebpackPlugin = require('copy-webpack-plugin')
piotr.kupczyk@id.ethz.ch
committed
const path = require('path')
piotr.kupczyk@id.ethz.ch
committed
entry: './src/js/index.js',
piotr.kupczyk@id.ethz.ch
committed
path: __dirname + '/build/js',
piotr.kupczyk@id.ethz.ch
committed
filename: 'bundle.[fullhash].js'
piotr.kupczyk@id.ethz.ch
committed
devtool: 'source-map',
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader']
piotr.kupczyk@id.ethz.ch
committed
use: ['style-loader', 'css-loader']
{
test: /\.(png|svg|jpg|jpeg|gif|ico)$/i,
piotr.kupczyk@id.ethz.ch
committed
type: 'asset'
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000
}
}
]
},
piotr.kupczyk@id.ethz.ch
committed
resolve: {
alias: {
'@src': path.resolve(__dirname, 'src/'),
'@srcTest': path.resolve(__dirname, 'srcTest/'),
'@srcV3': path.resolve(__dirname, 'srcV3/'),
'@srcDss': path.resolve(__dirname, 'srcDss/')
},
fallback: {
stream: require.resolve('stream-browserify'),
buffer: require.resolve('buffer')
piotr.kupczyk@id.ethz.ch
committed
}
},
plugins: [
new HtmlWebpackPlugin({
inject: 'body',
filename: './index.html',
template: './index.html'
}),
new Webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer']
piotr.kupczyk@id.ethz.ch
committed
}),
new Webpack.ProvidePlugin({
process: 'process/browser'
piotr.kupczyk@id.ethz.ch
committed
}),
new CopyWebpackPlugin({
patterns: [{ from: 'src/resources' }]