const path = require('path');
const {
CleanWebpackPlugin
} = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: {
index: './src/js/index.js'
},
output: {
filename: './js/[name].js',
path: path.resolve(__dirname, '../build'),
publicPath: '/'
},
module: {
rules: [{
test: /\.js$/,
exclude: /(node_modules)/,
use: {
loader: "babel-loader"
}
}]
},
resolve: {
modules: [path.join(__dirname, 'src'), 'node_modules']
},
plugins: [
new CleanWebpackPlugin(),
new CopyWebpackPlugin({
patterns: [{
from: 'src/',
globOptions: {
ignore: [
'**/js/**/*',
'**/root/**/*'
]
}
}, {
from: 'src/root/**/*',
flatten: true
}]
})
]
};