Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaffold webpack plugin setup #34

Open
wants to merge 1 commit into
base: naugtur/lavamoat-allow-scripts
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
},
"devDependencies": {
"@lavamoat/preinstall-always-fail": "^2.0.0",
"@lavamoat/webpack": "^0.3.0-beta.0",
"@localazy/cli": "^1.7.5",
"@types/chrome": "^0.0.259",
"@types/object-hash": "^2.2.1",
Expand Down
20 changes: 14 additions & 6 deletions webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
const WextManifestWebpackPlugin = require('wext-manifest-webpack-plugin');
const DotenvPlugin = require('dotenv-webpack');
const LavaMoatPlugin = require('@lavamoat/webpack');

const srcDir = path.join(__dirname, '..', 'src');
const targetBrowser = process.env.TARGET_BROWSER;
Expand Down Expand Up @@ -43,17 +44,20 @@ module.exports = {
{
test: /\.css$/i,
include: path.resolve(srcDir),
use: ['style-loader', 'css-loader', 'postcss-loader'],
use: ['style-loader', 'css-loader', 'postcss-loader', LavaMoatPlugin.exclude],
},
{
type: 'javascript/auto', // prevent webpack handling json with its own loaders,
test: /manifest\.json$/,
use: {
loader: 'wext-manifest-loader',
options: {
usePackageJSONVersion: true,
use: [
{
loader: 'wext-manifest-loader',
options: {
usePackageJSONVersion: true,
},
},
},
LavaMoatPlugin.exclude,
],
exclude: /node_modules/,
},
],
Expand All @@ -69,6 +73,10 @@ module.exports = {
},

plugins: [
new LavaMoatPlugin({
generatePolicy: true,
diagnosticsVerbosity: 2,
}),
new WextManifestWebpackPlugin(),
new CopyPlugin({
patterns: [
Expand Down
Loading