blob: 7287e6c49168976113aa51a863225dfe45d234db [file] [log] [blame]
Adrià Vilanova Martínezf7ee6582021-09-02 21:53:28 +02001const path = require('path')
2const json5 = require('json5');
3const {VueLoaderPlugin} = require('vue-loader');
4const HtmlWebpackPlugin = require('html-webpack-plugin');
5
6module.exports = (env, args) => {
7 return {
8 entry: './src/main.js',
9 output: {
10 filename: '[name].[contenthash:8].bundle.js',
11 path: path.resolve(__dirname, './dist'),
12 clean: true,
13 },
14 module: {
15 rules: [
16 {
17 test: /\.vue$/,
18 loader: 'vue-loader',
19 },
20 {
21 test: /\.s[ac]ss$/,
22 use: [
23 'vue-style-loader',
24 'css-loader',
25 'sass-loader',
26 ],
27 },
28 {
29 test: /\.css$/,
30 use: [
31 'vue-style-loader',
32 'css-loader',
33 ],
34 },
35 {
36 test: /\.json5$/,
37 type: 'json',
38 parser: {
39 parse: json5.parse,
40 },
41 }
42 ],
43 },
44 plugins: [
45 new VueLoaderPlugin(),
46 new HtmlWebpackPlugin({
47 filename: 'index.html',
48 template: 'index.html',
49 }),
50 ],
51 devServer: {
52 static: './dist',
53 },
54 devtool: (args.mode == 'production' ? 'source-map' : 'inline-source-map'),
55 };
56};