forked from electron/electronjs.org-old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.js
39 lines (32 loc) · 896 Bytes
/
webpack.common.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const path = require('path')
const { WebpackManifestPlugin } = require('webpack-manifest-plugin')
const env = process.env.NODE_ENV
module.exports = {
entry: { index: './scripts/index.js' },
output: {
filename: env === 'production' ? '[name].[chunkhash].min.js' : '[name].js',
path: path.resolve(__dirname, 'precompiled', 'scripts'),
publicPath: '/scripts/',
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
plugins: [new WebpackManifestPlugin()],
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',
}