aboutsummaryrefslogtreecommitdiff
path: root/webpack.config.js
blob: c0286df47686e2d910dae3243b6aa7963941207e (plain)
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 PrettierPlugin = require('prettier-webpack-plugin');

module.exports = (env) => {
	return {
		// Environment dependent
		mode: env == 'dev' ? 'development' : 'production',
		devtool: env == 'dev' ? 'inline-source-map' : 'none',
		stats: env == 'dev' ? {} : { warnings: false },

		// Constant
		entry: {
			edit: './src/edit.js',
		},
		output: {
			filename: 'assets/js/[name].bundle.js',
			path: path.resolve(__dirname),
			libraryTarget: 'window'
		},
		module: {
			rules: [
				{
					test: /\.css$/,
					use: [
						'style-loader',
						'css-loader',
					],
				},
			],
		},
		plugins: [
			new PrettierPlugin({
				tabWidth: 4,
				trailingComma: 'es5',
				singleQuote: true,
			})
		],
	}
};