forked from DecisionsDev/odm-decision-forms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.lib.config.js
112 lines (109 loc) · 3.26 KB
/
webpack.lib.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
'use strict';
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var LodashModuleReplacementPlugin = require('lodash-webpack-plugin');
var es3ifyPlugin = require('es3ify-webpack-plugin');
module.exports = {
entry: {
form: [
'event-source-polyfill',
"babel-polyfill",
path.join(__dirname, 'src/client/embedded.tsx')
]
},
target: "web",
output: {
path: path.join(__dirname, '/lib/'),
filename: '[name].js',
libraryTarget: 'umd',
// umdNamedDefine: true,
library: 'OdmDecisionForms'
},
resolve: {
// Add '.ts' and '.tsx' as resolvable extensions.
extensions: [".ts", ".tsx", ".js", ".json"]
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
}),
new ExtractTextPlugin("styles.css"),
new es3ifyPlugin(),
new LodashModuleReplacementPlugin,
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false,
screw_ie8: true
}
})
],
module: {
rules: [
{
test: /\.(ttf|eot|woff|woff2|svg)$/,
loader: 'file-loader',
options: {
name: 'assets/fonts/[name].[ext]',
}
},
{
test: /\.(t|j)sx?$/,
use: {
loader: 'awesome-typescript-loader',
options: {
silent: true
}
}
},
{
enforce: "pre",
test: /\.js$/,
loader: "source-map-loader"
},
{
test: /\.css$/,
exclude: /node_modules/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: {loader: 'css-loader', options: {minimize: true}}
})
},
{
test: /\.scss$/,
exclude: /node_modules/,
use: ExtractTextPlugin.extract({
use: [{loader: 'css-loader', options: {minimize: true}}, {
loader: 'sass-loader',
options: {minimize: true}
}]
})
},
{
use: {
loader: 'babel-loader',
options: {
plugins: [
'lodash',
'transform-es3-member-expression-literals',
'transform-es3-property-literals'
]
// presets: [['env', {
// 'modules': false,
// 'targets': {
// 'browsers': 'ie >= 8'
// }
// }]]
}
},
test: /\.js$/
}
]
},
node: {
console: true,
fs: 'empty',
net: 'empty',
tls: 'empty'
}
};