-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.base.js
70 lines (67 loc) · 1.8 KB
/
webpack.config.base.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
70
const path = require('path')
const webpack = require('webpack')
const DirectoryNamedWebpackPlugin = require('directory-named-webpack-plugin')
const webpackConfig = (config) => {
return {
devServer: {
contentBase: [
path.resolve(__dirname, 'public'),
],
disableHostCheck: true, // https://github.com/webpack/webpack-dev-server/issues/882
compress: true,
host: '0.0.0.0',
port: 8080
},
mode: config.mode,
devtool: config.devtool || 'source-maps',
optimization: config.optimization,
entry: path.resolve(__dirname, 'src/main.js'),
externals: config.externals,
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: [path.resolve(__dirname, './node_modules')]
},
{
test: /\.scss$/,
loaders: ['style-loader?singleton=true', 'css-loader', 'postcss-loader', 'sass-loader'],
include: path.resolve(__dirname, 'src')
},
{
test: /\.(png|woff|eot|swf|cur|ttf)/,
loader: 'url-loader',
options: {
limit: 1,
publicPath: '<%=baseUrl%>/'
},
},
{
test: /\.html/, loader: 'html-loader?minimize=false'
},
...(config.rules || [])
],
},
resolve: {
plugins: [
new DirectoryNamedWebpackPlugin(true),
],
modules: ['node_modules']
},
output: {
path: path.resolve(__dirname, 'dist'),
publicPath: 'dist/',
filename: config.filename,
library: 'ClapprFlash',
libraryTarget: 'umd'
},
plugins: [
new webpack.DefinePlugin({
VERSION: JSON.stringify(require('./package.json').version),
}),
...(config.plugins || [])
],
}
}
module.exports = webpackConfig