-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
69 lines (65 loc) · 1.67 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
68
69
const path = require('path');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const createConfig = (name) => {
return {
context: path.resolve(__dirname, 'src'),
entry: `./${name}.js`,
output: {
path: path.join(__dirname, 'dist'),
filename: `h5p-hub-${name}.js`,
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
include: [
path.resolve(__dirname, 'src')
],
use: 'babel-loader'
},
{
test: /\.scss$/,
include: path.resolve(__dirname, 'src'),
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader',
],
},
{
test: /\.css$/,
include: path.resolve(__dirname, 'node_modules/normalize.css'),
use: [
MiniCssExtractPlugin.loader,
'css-loader'
],
},
{
test: /\.(svg)$/,
include: path.resolve(__dirname, 'src'),
loader: 'url-loader',
options: {
limit: 1000000
}
}
]
},
plugins: [
new MiniCssExtractPlugin({
filename: `h5p-hub-${name}.css`
})
]
};
};
const sharingConfig = createConfig('sharing');
const registrationConfig = createConfig('registration');
module.exports = (env, argv) => {
sharingConfig.mode = argv.mode;
registrationConfig.mode = argv.mode;
if (argv.mode === 'development') {
sharingConfig.devtool = 'inline-source-map';
registrationConfig.devtool = 'inline-source-map';
// config.entry = "./src/entries/dev.js";
}
return [sharingConfig, registrationConfig];
};