2021-01-08 22:36:33 +03:00
|
|
|
const path = require('path')
|
2021-03-05 01:47:18 +03:00
|
|
|
const { WebpackManifestPlugin } = require('webpack-manifest-plugin')
|
2021-01-08 22:36:33 +03:00
|
|
|
|
|
|
|
const env = process.env.NODE_ENV
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
entry: { index: './scripts/index.js' },
|
|
|
|
output: {
|
2021-03-05 01:47:18 +03:00
|
|
|
filename: env === 'production' ? '[name].[chunkhash].min.js' : '[name].js',
|
2021-01-08 22:36:33 +03:00
|
|
|
path: path.resolve(__dirname, 'precompiled', 'scripts'),
|
|
|
|
publicPath: '/scripts/',
|
|
|
|
},
|
|
|
|
|
|
|
|
resolve: {
|
|
|
|
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
|
|
},
|
|
|
|
|
2021-03-05 01:47:18 +03:00
|
|
|
plugins: [new WebpackManifestPlugin()],
|
|
|
|
|
2021-01-08 22:36:33 +03:00
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.m?js$/,
|
|
|
|
exclude: /(node_modules|bower_components)/,
|
|
|
|
use: {
|
|
|
|
loader: 'babel-loader',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.hbs$/,
|
|
|
|
loader: 'handlebars-loader',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
devtool: env === 'production' ? 'inline-source-map' : 'source-map',
|
|
|
|
|
|
|
|
mode: env === 'production' ? 'production' : 'development',
|
|
|
|
}
|