This repository was archived by the owner on Sep 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathwebpack.exhibition.config.js
77 lines (76 loc) · 1.9 KB
/
webpack.exhibition.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
70
71
72
73
74
75
76
77
const webpack = require('webpack')
const cssnano = require('cssnano')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const postcssSimpleVars = require('postcss-simple-vars')
const postcssInherit = require('postcss-inherit')
const postcssImport = require('postcss-import')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
entry: {
exhibition: './exhibition/main.tsx',
},
output: {
filename: '[name].[hash].js',
publicPath: '/',
},
module: {
rules: [{
enforce: 'pre',
test: /\.ts(x?)$/,
loader: 'tslint-loader',
}, {
test: /\.css$/,
exclude: /particles\.css/,
loader: ExtractTextPlugin.extract({
loader: 'css-loader?modules!postcss-loader',
}),
}, {
test: /particles\.css$/,
loader: ExtractTextPlugin.extract({
loader: 'css-loader?modules&localIdentName=[local]!postcss-loader',
}),
}, {
test: /\.ts(x?)$/,
loader: 'awesome-typescript-loader',
}, {
test: /icons\/.*\.svg$/,
loader: 'raw-loader!svgo-loader',
}],
},
plugins: [
new ExtractTextPlugin('styles.css'),
new HtmlWebpackPlugin({
template: 'exhibition/index.html',
}),
new webpack.LoaderOptionsPlugin({
options: {
postcss: [
postcssImport(),
postcssInherit,
postcssSimpleVars({
variables: () => require('./dist/variables/variables'),
}),
cssnano({
autoprefixer: {
add: true,
remove: true,
browsers: ['last 2 versions'],
},
discardComments: {
removeAll: true,
},
safe: true,
})
],
svgo: {
plugins: [
{removeStyleElement: true},
],
},
}
}),
],
resolve: {
extensions: ['.js', '.ts', '.tsx'],
},
}