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 CopyWebpackPlugin = require('copy-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 MiniCssExtractPlugin = require('mini-css-extract-plugin');
const WextManifestWebpackPlugin = require('wext-manifest-webpack-plugin');
@ -64,7 +64,9 @@ module.exports = {
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json'],
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({
cleanOnceBeforeBuildPatterns: [
path.join(process.cwd(), `extension/${targetBrowser}`),
path.join(process.cwd(), `extension/${targetBrowser}.${getExtensionFileType(targetBrowser)}`),
path.join(
process.cwd(),
`extension/${targetBrowser}.${getExtensionFileType(targetBrowser)}`
),
],
cleanStaleWebpackAssets: false,
verbose: true,
@ -141,9 +146,9 @@ module.exports = {
filename: 'options.html',
}),
// write css file(s) to build folder
new MiniCssExtractPlugin({ filename: 'css/[name].css' }),
new MiniCssExtractPlugin({filename: 'css/[name].css'}),
// 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
extensionReloaderPlugin,
],
@ -162,7 +167,7 @@ module.exports = {
}),
new OptimizeCSSAssetsPlugin({
cssProcessorPluginOptions: {
preset: ['default', { discardComments: { removeAll: true } }],
preset: ['default', {discardComments: {removeAll: true}}],
},
}),
new ZipPlugin({