-
Notifications
You must be signed in to change notification settings - Fork 96
/
webpack.config.examples.js
64 lines (62 loc) · 1.62 KB
/
webpack.config.examples.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
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
import HtmlBundlerPlugin from 'html-bundler-webpack-plugin';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
/* eslint-disable no-underscore-dangle */
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default {
mode: 'development',
entry: {
index: path.join(__dirname, 'examples/src/index.js'),
style: path.join(__dirname, 'examples/src/scss/style.scss'),
},
output: {
path: path.join(__dirname, 'examples/dist'),
library: {
name: 'D3Funnel',
type: 'umd',
},
},
resolve: {
extensions: ['.js'],
alias: {
'd3-funnel': path.resolve(__dirname, 'src/index.js'),
},
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /(node_modules)/,
loader: 'babel-loader',
},
{
test: /\.s[ac]ss$/i,
use: [
'css-loader',
'sass-loader',
],
},
],
},
devServer: {
open: true,
static: {
directory: path.join(__dirname, 'examples/dist'),
},
watchFiles: ['src/**/*', 'examples/src/**/*'],
},
plugins: [
new HtmlBundlerPlugin({
entry: {
index: 'examples/src/index.html',
},
js: {
filename: '[name].[contenthash:8].js',
},
css: {
filename: '[name].[contenthash:8].css',
},
}),
],
};