2019-04-08 10:31:53 +03:00
|
|
|
const path = require("path");
|
|
|
|
const TerserPlugin = require("terser-webpack-plugin");
|
2019-05-20 12:35:56 +03:00
|
|
|
const CircularDependencyPlugin = require("circular-dependency-plugin");
|
2018-12-27 11:49:09 +03:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
entry: {
|
2019-04-08 10:31:53 +03:00
|
|
|
"azdevops-kube-summary": "./src/index.ts",
|
|
|
|
"azdevops-kube-summary.min": "./src/index.ts"
|
2018-12-27 11:49:09 +03:00
|
|
|
},
|
|
|
|
output: {
|
2019-04-08 10:31:53 +03:00
|
|
|
path: path.resolve(__dirname, "_bin/webAppPackage/_bundles"),
|
|
|
|
filename: "[name].js",
|
|
|
|
libraryTarget: "umd",
|
|
|
|
library: "webapp-kube-summary",
|
2018-12-27 11:49:09 +03:00
|
|
|
umdNamedDefine: true
|
|
|
|
},
|
|
|
|
resolve: {
|
2019-04-08 10:31:53 +03:00
|
|
|
extensions: [".ts", ".tsx", ".js"]
|
2018-12-27 11:49:09 +03:00
|
|
|
},
|
2019-04-08 10:31:53 +03:00
|
|
|
devtool: "source-map",
|
2018-12-27 11:49:09 +03:00
|
|
|
optimization: {
|
|
|
|
minimizer: [
|
2019-02-08 16:09:44 +03:00
|
|
|
new TerserPlugin({
|
2018-12-27 11:49:09 +03:00
|
|
|
sourceMap: true,
|
|
|
|
include: /\.min\.js$/,
|
2019-02-08 16:09:44 +03:00
|
|
|
parallel: 4
|
2018-12-27 11:49:09 +03:00
|
|
|
})
|
|
|
|
]
|
|
|
|
},
|
2019-05-20 12:35:56 +03:00
|
|
|
plugins: [
|
|
|
|
new CircularDependencyPlugin({
|
|
|
|
onStart({ compilation }) {
|
|
|
|
// `onStart` is called before the cycle detection starts
|
|
|
|
console.log("Detecting webpack modules cycles -- start.");
|
|
|
|
},
|
|
|
|
onDetected({ module: webpackModuleRecord, paths, compilation }) {
|
|
|
|
// `paths` will be an Array of the relative module paths that make up the cycle
|
|
|
|
// `module` will be the module record generated by webpack that caused the cycle
|
|
|
|
const cyclePaths = paths.join(' -> ');
|
|
|
|
compilation.errors.push(new Error(cyclePaths))
|
|
|
|
console.error("Cycle detected: " + cyclePaths);
|
|
|
|
},
|
|
|
|
// `onEnd` is called before the cycle detection ends
|
|
|
|
onEnd({ compilation }) {
|
|
|
|
console.log("Done detecting webpack modules cycles.");
|
|
|
|
},
|
|
|
|
failOnError: true,
|
|
|
|
cwd: process.cwd()
|
|
|
|
})
|
|
|
|
],
|
2018-12-27 11:49:09 +03:00
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.tsx?$/,
|
|
|
|
loader: "ts-loader"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.scss$/,
|
|
|
|
use: ["style-loader", "css-loader", "./buildScripts/css-variables-loader", "sass-loader"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
use: ["style-loader", "css-loader"],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.woff$/,
|
|
|
|
use: [{
|
2019-04-08 10:31:53 +03:00
|
|
|
loader: "base64-inline-loader"
|
2018-12-27 11:49:09 +03:00
|
|
|
}]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.html$/,
|
|
|
|
loader: "file-loader"
|
2019-02-01 11:46:04 +03:00
|
|
|
},
|
2019-04-08 10:31:53 +03:00
|
|
|
{ test: /\.(png|jpg|svg)$/, loader: "file-loader" },
|
2018-12-27 11:49:09 +03:00
|
|
|
]
|
|
|
|
},
|
|
|
|
node: {
|
2019-04-08 10:31:53 +03:00
|
|
|
fs: "empty",
|
|
|
|
tls: "mock",
|
|
|
|
child_process: "empty",
|
|
|
|
net: "empty"
|
2018-12-27 11:49:09 +03:00
|
|
|
},
|
2019-04-05 11:48:19 +03:00
|
|
|
externals: {
|
2019-04-08 10:31:53 +03:00
|
|
|
"react": "react",
|
|
|
|
"react-dom": "react-dom"
|
2019-04-05 11:48:19 +03:00
|
|
|
}
|
2018-12-27 11:49:09 +03:00
|
|
|
}
|