This repository has been archived by the owner on Feb 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
65 lines (58 loc) · 1.84 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
const webpack = require('webpack');
const path = require('path');
const WriteFilePlugin = require('write-file-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const outputPath = path.join(__dirname, 'lib');
module.exports = {
devtool: 'source-map',
entry: {
'demo': [
'./ui/app.tsx',
'./ui/demo.scss',
],
},
output: {
path: outputPath,
filename: '[name].js',
sourceMapFilename: '[name].js.map',
publicPath: '/assets/'
},
resolve: {
extensions: ['.ts', '.js', '.json', '.scss', '.css', '.html', '.tsx'],
unsafeCache: true,
symlinks: false
},
module: {
rules: [{
test: /\.ts$/,
use: ["awesome-typescript-loader"],
exclude: /node_modules/
}, {
test: /\.tsx$/,
use: ['awesome-typescript-loader'],
exclude: /node_modules/
}, {
test: /\.js$/,
use: ['babel-loader?{"presets":["es2015"],"cacheDirectory":true}'],
exclude: /(node_modules|bower_components)/
}, {
test: /\.scss$/,
use: ["file-loader?name=[name].css", "extract-loader", "css-loader", "resolve-url-loader", "sass-loader?sourceMap"]
}, {
test: /\.css$/,
use: ["file-loader?name=[name].css", "extract-loader", "css-loader"]
}, {
test: /\.html$/,
use: 'html-loader'
}, {
test: /\.(ttf|jpg|png|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/,
use: 'file-loader?name=[name].[ext]'
}]
},
plugins: [
new WriteFilePlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': process.env.NODE_ENV ? JSON.stringify(process.env.NODE_ENV) : JSON.stringify('production')
}),
]
};