This commit is contained in:
Dylan Vorster
2019-07-24 00:31:31 +02:00
parent 01e9f5f2db
commit def92af022
152 changed files with 3771 additions and 590 deletions

44
webpack.shared.js Normal file
View File

@ -0,0 +1,44 @@
const production = process.env.NODE_ENV === "production";
const TerserPlugin = require('terser-webpack-plugin');
const nodeExternals = require('webpack-node-externals');
const path = require('path');
module.exports = (directory) => {
return {
entry: path.join(directory, 'index.ts'),
output: {
filename: "index.js",
path: path.join(directory, 'dist'),
libraryTarget: "umd",
},
externals: [
nodeExternals({modulesDir: path.join(directory, 'node_modules')}),
nodeExternals({modulesDir: path.join(path.join(directory, '..'), 'node_modules')})
],
module: {
rules: [
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader']
},
{
enforce: "pre",
test: /\.js$/,
loader: "source-map-loader"
},
{
test: /\.tsx?$/,
loader: "ts-loader"
}
]
},
resolve: {
extensions: [".tsx", ".ts", ".js"]
},
devtool: production ? "source-map" : "cheap-module-source-map",
mode: production ? "production" : "development",
optimization: {
minimizer: [new TerserPlugin()],
}
}
}