-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
67 lines (62 loc) · 1.21 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
59
60
61
62
63
64
65
66
67
const webpack = require('webpack');
const baseConfig = require('@swup/webpack-config');
const name = require('./package.json').name;
const upperFirst = require('lodash/upperFirst');
const camelCase = require('lodash/camelCase');
const PascalCaseName = upperFirst(camelCase(name));
const loaders = [
{
test: /\.css$/,
use: [
'css-loader',
]
},
{
test: /\.styl$/,
loader: 'css-loader!stylus-loader?paths=node_modules/bootstrap-stylus/stylus/'
},
{
test: /\.scss$/,
use: [
"css-loader",
"sass-loader"
]
}
];
const config = Object.assign({}, baseConfig, {
entry: {
[PascalCaseName]: './entry.js',
[`${PascalCaseName}.min`]: './entry.js'
},
output: {
path: __dirname + '/dist/',
library: PascalCaseName,
libraryTarget: 'umd',
filename: '[name].js'
},
module: {
rules: [
...baseConfig.module.rules,
...loaders
],
},
});
const configForNpm = Object.assign({}, baseConfig, {
entry: {
'index': './entry.js',
'index.min': './entry.js'
},
output: {
path: __dirname + '/lib/',
library: PascalCaseName,
libraryTarget: 'umd',
filename: '[name].js'
},
module: {
rules: [
...baseConfig.module.rules,
...loaders
],
},
});
module.exports = [config, configForNpm];