mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 06:13:38 +00:00
fix: webpack.config.js plugin (#525)
This commit is contained in:
@@ -4,7 +4,7 @@ const webpack = require('webpack');
|
||||
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
const AngularCompilerPlugin = require('@ngtools/webpack').AngularCompilerPlugin;
|
||||
const pjson = require('./package.json');
|
||||
@@ -14,12 +14,6 @@ if (process.env.NODE_ENV == null) {
|
||||
}
|
||||
const ENV = process.env.ENV = process.env.NODE_ENV;
|
||||
|
||||
const extractCss = new ExtractTextPlugin({
|
||||
filename: '[name].[hash].css',
|
||||
disable: false,
|
||||
allChunks: true,
|
||||
});
|
||||
|
||||
const moduleRules = [
|
||||
{
|
||||
test: /\.ts$/,
|
||||
@@ -54,13 +48,16 @@ const moduleRules = [
|
||||
},
|
||||
{
|
||||
test: /\.scss$/,
|
||||
use: extractCss.extract({
|
||||
use: [
|
||||
{ loader: 'css-loader' },
|
||||
{ loader: 'sass-loader' },
|
||||
],
|
||||
publicPath: '../',
|
||||
}),
|
||||
use: [
|
||||
{
|
||||
loader: MiniCssExtractPlugin.loader,
|
||||
options: {
|
||||
publicPath: '../',
|
||||
}
|
||||
},
|
||||
'css-loader',
|
||||
'sass-loader'
|
||||
],
|
||||
},
|
||||
// Hide System.import warnings. ref: https://github.com/angular/angular/issues/21560
|
||||
{
|
||||
@@ -103,7 +100,10 @@ const plugins = [
|
||||
{ from: './node_modules/qrious/dist/qrious.min.js', to: 'scripts' },
|
||||
{ from: './node_modules/braintree-web-drop-in/dist/browser/dropin.js', to: 'scripts' },
|
||||
]),
|
||||
extractCss,
|
||||
new MiniCssExtractPlugin({
|
||||
filename: '[name].[hash].css',
|
||||
chunkFilename: '[id].[hash].css'
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': {
|
||||
'ENV': JSON.stringify(ENV),
|
||||
@@ -193,4 +193,4 @@ const config = {
|
||||
plugins: plugins,
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
module.exports = config;
|
||||
Reference in New Issue
Block a user