-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathwebpack.dev.js
More file actions
68 lines (67 loc) · 2.38 KB
/
webpack.dev.js
File metadata and controls
68 lines (67 loc) · 2.38 KB
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
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
mode: 'development',
entry: {
polipop: './src/index.js',
'css/polipop.core': './src/sass.js/core.scss.js',
'css/polipop.default': './src/sass.js/default.scss.js',
'css/polipop.compact': './src/sass.js/compact.scss.js',
'css/polipop.minimal': './src/sass.js/minimal.scss.js',
},
devtool: 'inline-source-map', // Enables us to see source files in browser dev tools.
devServer: {
contentBase: './docs',
// webpack-dev-server does not store bundled files. After the dev build, it keeps them in memory
// and serves them by default under http://[devServer.host]:[devServer.port]/[output.filename]
//
// Since the /docs/index.html page expects to find the bundled files
// at http://[devServer.host]:[devServer.port]/dist/, we change the directory via the option
// publicPath, so that the virtual files are now served under
// http://[devServer.host]:[devServer.port]/[devServer.publicPath]/[output.filename]
publicPath: '/dist/',
// this solves an issue where the entry point path is incorrect when running dev-server
// Remove if path is fixed in newer webpack versions:
injectClient: false,
},
module: {
rules: [
{
test: /\.m?js$/,
exclude: /(node_modules|docs)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
},
},
},
{
test: /\.scss$/i,
use: [
MiniCssExtractPlugin.loader,
{ loader: 'css-loader', options: { sourceMap: true } },
{ loader: 'sass-loader', options: { sourceMap: true } },
],
},
],
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css',
}),
],
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
library: {
name: 'Polipop',
type: 'umd',
export: 'default',
},
globalObject: 'this',
},
optimization: {
minimize: false,
},
};