-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
59 lines (57 loc) · 1.76 KB
/
webpack.config.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
import path from 'path';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import { fileURLToPath } from 'url';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import IgnoreEmitPlugin from 'ignore-emit-webpack-plugin';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default {
entry:
{
// Here entry points are added with the "name" field, and the styles.bundle.css file is added to ignore
// If the entry points are simply placed in an array, then will matter the order in which they are written.
// And exports will be added only from the last element of the array.
'index': './src/js/index.js',
'styles': './src/css/style.css'
},
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist'),
clean: true,
library: 'elsciPuck',
libraryTarget: 'umd'
},
devtool: "source-map",
module: {
rules: [
{
test: /\.(css|sass|scss)$/,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
{
test: /\.js$/,
enforce: 'pre',
use: ['source-map-loader'],
},
],
},
plugins: [
new MiniCssExtractPlugin({
filename: 'style.bundle.css'
}),
new HtmlWebpackPlugin({
template: './src/index.html',
filename: 'index.html'
}),
new IgnoreEmitPlugin([/styles.*\.js$/])
],
devServer: {
static: {
directory: path.join(__dirname, 'dist'),
},
compress: true,
host: '0.0.0.0',
port: 8081,
},
mode:'development'
};