GoogleChrome / GoogleChrome/workbox

Getting error " Error: AngularCompilerPlugin is running in a child compilation, but couldnot find a WebpackCompilerHost in the parent compilation."

Open
#3,368 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
13k
Forks
880
Avg merge
2h 44m
Merged PRs (30d)
8

Description

In My project workbox-webpack-plugin is used.
It was working fine till angular 10. when i Migrated it to 11, i got error in "npm run build" command .
Error-
" Error: AngularCompilerPlugin is running in a child compilation, but couldnot find a WebpackCompilerHost in the parent compilation."
my workbook config file -

const { InjectManifest } = require('workbox-webpack-plugin');
const AotPlugin = require('@ngtools/webpack').AngularCompilerPlugin;
const path = require('path');

module.exports = {
plugins: [
new InjectManifest({
maximumFileSizeToCacheInBytes: "26214400",
compileSrc: true,
swDest: "service-worker.js",
swSrc: "./src/app/utilities/service-worker.ts",
webpackCompilationPlugins: [
new AotPlugin({
tsConfigPath: path.join(__dirname, '../src/tsconfig.app.json'),
// mainPath: path.join(__dirname, './src/main.ts'),
// typeChecking: false,
}),
]
})
]
};

I am using -
"workbox-routing": "^5.1.3",
"workbox-precaching": "^5.1.3",
"workbox-core": "^5.1.3",
"workbox-webpack-plugin": "^5.1.3"
"workbox-cli": "^5.1.3",
"webpack-cli": "^3.3.7",

tsconfig file
{
"compileOnSave": false,
"compilerOptions": {
"downlevelIteration": true,
"importHelpers": true,
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es2018",
"skipLibCheck": true,
"typeRoots": ["node_modules/@types"],
"lib": ["es2017", "dom", "webworker"],
"module": "ES2020",
"baseUrl": "./",
"strict": false
}

}
COuld you please help me to resolve this issue.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.