-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
64 lines (56 loc) · 2.05 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
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
const { TsConfigPathsPlugin } = require('awesome-typescript-loader');
module.exports = {
entry: {
container_content: "./kive/container/static/container/container_content.ts"
},
output: {
filename: "[name].bundle.js",
path: __dirname + "/kive/portal/static/portal"
},
// Enable sourcemaps for debugging webpack's output.
// Suggested: eval-source-map when debugging, nosources-source-map in production
devtool: "nosources-source-map",
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
}),
new webpack.SourceMapDevToolPlugin({
filename: null, // if no value is provided the sourcemap is inlined
test: /\.(ts|js)($|\?)/i // process .js and .ts files only
})
],
optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
},
resolve: {
// Add '.ts' and '.tsx' as resolvable extensions.
extensions: [".webpack.js", ".web.js", ".ts", ".tsx", ".js", ".css"],
plugins: [ new TsConfigPathsPlugin() ],
fallback: {fs: false}
},
module: {
rules: [
// All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
{ test: /\.tsx?$/, loader: "awesome-typescript-loader" },
{ test: /(permissions|ajaxsearchfilter|noxss|md5|choose_inputs)\.js$/, loader: 'script-loader' },
{ test: /\.css$/, use: [ "style-loader", "css-loader" ] },
{
test: /\.s[ac]ss$/,
use: [
"style-loader", // creates style nodes from JS strings
"css-loader", // translates CSS into CommonJS
"sass-loader" // compiles Sass to CSS
]
}
]
}
};