mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 06:13:38 +00:00
pack with ngtools
This commit is contained in:
21
webpack2.js
21
webpack2.js
@@ -4,6 +4,7 @@ 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 AngularCompilerPlugin = require('@ngtools/webpack').AngularCompilerPlugin;
|
||||
|
||||
const isVendorModule = (module) => {
|
||||
if (!module.context) {
|
||||
@@ -40,9 +41,8 @@ module.exports = {
|
||||
loader: 'tslint-loader'
|
||||
},
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
use: 'ts-loader',
|
||||
exclude: /node_modules\/(?!(@bitwarden)\/).*/
|
||||
test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
|
||||
loader: '@ngtools/webpack'
|
||||
},
|
||||
{
|
||||
test: /\.(html)$/,
|
||||
@@ -92,6 +92,11 @@ module.exports = {
|
||||
new CleanWebpackPlugin([
|
||||
path.resolve(__dirname, 'build2/*')
|
||||
]),
|
||||
new AngularCompilerPlugin({
|
||||
tsConfigPath: 'tsconfig.json',
|
||||
entryModule: 'src/popup2/app.module#AppModule',
|
||||
sourceMap: true
|
||||
}),
|
||||
// ref: https://github.com/angular/angular/issues/20357
|
||||
new webpack.ContextReplacementPlugin(
|
||||
/\@angular(\\|\/)core(\\|\/)esm5/,
|
||||
@@ -110,7 +115,7 @@ module.exports = {
|
||||
new HtmlWebpackPlugin({
|
||||
template: './src/popup2/index.html',
|
||||
filename: 'popup/index.html',
|
||||
chunks: ['popup/vendor', 'popup/main', 'fonts']
|
||||
chunks: ['popup/vendor', 'popup/main']
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
template: './src/background.html',
|
||||
@@ -135,10 +140,10 @@ module.exports = {
|
||||
{ from: './src/images', to: 'images' },
|
||||
{ from: './src/content/autofill.css', to: 'content' }
|
||||
]),
|
||||
new webpack.SourceMapDevToolPlugin({
|
||||
filename: '[name].js.map',
|
||||
include: ['popup/main.js', 'background.js']
|
||||
}),
|
||||
//new webpack.SourceMapDevToolPlugin({
|
||||
// filename: '[name].js.map',
|
||||
// include: ['popup/main.js', 'background.js']
|
||||
//}),
|
||||
extractCss
|
||||
],
|
||||
resolve: {
|
||||
|
||||
Reference in New Issue
Block a user