chore: minor linting to webpack config

This commit is contained in:
abhijithvijayan 2020-04-17 15:58:08 +05:30
parent 2d510b8f30
commit 18fa5f9ed9

View File

@ -4,7 +4,7 @@ const ZipPlugin = require('zip-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin'); const TerserPlugin = require('terser-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const {CleanWebpackPlugin} = require('clean-webpack-plugin');
const ExtensionReloader = require('webpack-extension-reloader'); const ExtensionReloader = require('webpack-extension-reloader');
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const WextManifestWebpackPlugin = require('wext-manifest-webpack-plugin'); const WextManifestWebpackPlugin = require('wext-manifest-webpack-plugin');
@ -64,7 +64,9 @@ module.exports = {
resolve: { resolve: {
extensions: ['.ts', '.tsx', '.js', '.json'], extensions: ['.ts', '.tsx', '.js', '.json'],
alias: { alias: {
'webextension-polyfill-ts': path.resolve(path.join(__dirname, 'node_modules', 'webextension-polyfill-ts')), 'webextension-polyfill-ts': path.resolve(
path.join(__dirname, 'node_modules', 'webextension-polyfill-ts')
),
}, },
}, },
@ -123,7 +125,10 @@ module.exports = {
new CleanWebpackPlugin({ new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: [ cleanOnceBeforeBuildPatterns: [
path.join(process.cwd(), `extension/${targetBrowser}`), path.join(process.cwd(), `extension/${targetBrowser}`),
path.join(process.cwd(), `extension/${targetBrowser}.${getExtensionFileType(targetBrowser)}`), path.join(
process.cwd(),
`extension/${targetBrowser}.${getExtensionFileType(targetBrowser)}`
),
], ],
cleanStaleWebpackAssets: false, cleanStaleWebpackAssets: false,
verbose: true, verbose: true,
@ -141,9 +146,9 @@ module.exports = {
filename: 'options.html', filename: 'options.html',
}), }),
// write css file(s) to build folder // write css file(s) to build folder
new MiniCssExtractPlugin({ filename: 'css/[name].css' }), new MiniCssExtractPlugin({filename: 'css/[name].css'}),
// copy static assets // copy static assets
new CopyWebpackPlugin([{ from: 'source/assets', to: 'assets' }]), new CopyWebpackPlugin([{from: 'source/assets', to: 'assets'}]),
// plugin to enable browser reloading in development mode // plugin to enable browser reloading in development mode
extensionReloaderPlugin, extensionReloaderPlugin,
], ],
@ -162,7 +167,7 @@ module.exports = {
}), }),
new OptimizeCSSAssetsPlugin({ new OptimizeCSSAssetsPlugin({
cssProcessorPluginOptions: { cssProcessorPluginOptions: {
preset: ['default', { discardComments: { removeAll: true } }], preset: ['default', {discardComments: {removeAll: true}}],
}, },
}), }),
new ZipPlugin({ new ZipPlugin({