-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.cjs
76 lines (74 loc) · 1.93 KB
/
webpack.config.cjs
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const SveltePreprocess = require('svelte-preprocess');
const Autoprefixer = require('autoprefixer');
const isDevelopment = process.env.NODE_ENV !== 'production';
module.exports = {
entry: './client/src/index.js',
mode: isDevelopment ? 'development' : 'production',
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.svelte$/,
exclude: /node_modules/,
use: {
loader: 'svelte-loader',
options: {
compilerOptions: {
// Dev mode must be enabled for HMR to work!
dev: true,
},
hotReload: true,
hotOptions: {
// List of options and defaults: https://www.npmjs.com/package/svelte-loader-hot#usage
noPreserveState: false,
optimistic: true,
},
preprocess: SveltePreprocess({
scss: true,
sass: true,
postcss: {
plugins: [
Autoprefixer,
],
},
}),
},
},
},
],
},
resolve: { extensions: ['*', '.js', '.jsx'] },
output: {
path: path.resolve(__dirname, 'public/'),
publicPath: '/',
filename: 'bundle.js',
},
devServer: {
static: {
directory: path.join(__dirname, 'public/'),
publicPath: '/dist/',
},
proxy: {
'/memory': 'http://localhost:8080',
},
port: 3000,
hot: true,
},
devtool: false,
plugins: [
new HtmlWebpackPlugin({
template: path.join(__dirname, '/client/public/index.html/'),
favicon: path.join(__dirname, '/client/public/favicon.ico'),
}),
new webpack.SourceMapDevToolPlugin({
filename: '[file].map',
exclude: ['tone'],
}),
],
};