31 lines
670 B
JavaScript
31 lines
670 B
JavaScript
const path = require('path')
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
|
|
|
module.exports = (env) => {
|
|
return {
|
|
entry: './src/index.js',
|
|
output: {
|
|
path: path.resolve(__dirname, 'dist'),
|
|
filename: 'app.js'
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.js$/,
|
|
exclude: /(node_modules)/,
|
|
use: {
|
|
loader: 'babel-loader',
|
|
options: {
|
|
presets: ['@babel/preset-env']
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
devtool: env.mode === 'development' ? 'inline-source-map' : '',
|
|
plugins: [
|
|
new HtmlWebpackPlugin({ template: 'index.html' })
|
|
]
|
|
}
|
|
}
|