chore: allow passing NodeEnv to the code

This commit is contained in:
tiddlygit-test 2021-04-18 21:44:34 +08:00
parent 7727a0e3cc
commit afe8ecd076

View file

@ -1,12 +1,10 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const webpack = require('webpack');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const CspHtmlWebpackPlugin = require('csp-html-webpack-plugin');
const CircularDependencyPlugin = require('circular-dependency-plugin');
const webpack = require('webpack');
const CopyPlugin = require('copy-webpack-plugin');
const isDevelopment = process.env.NODE_ENV === 'development';
exports.main = [
// we only need one instance of TsChecker, it will check main and renderer all together
// new ForkTsCheckerWebpackPlugin(),
@ -28,13 +26,16 @@ exports.main = [
// set the current working directory for displaying module paths
cwd: process.cwd(),
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': `"${process.env.NODE_ENV ?? 'production'}"`,
}),
];
exports.renderer = [
// new webpack.DefinePlugin({
// 'process.env': '{}',
// global: {},
// }),
new webpack.DefinePlugin({
'process.env.NODE_ENV': `"${process.env.NODE_ENV ?? 'production'}"`,
// global: {},
}),
new CspHtmlWebpackPlugin(
{
'base-uri': ["'self'"],