Comments (17)
I can't reproduce this. What version of webpack did you upgrade from? Can you provide the complete build output?
from dojo-webpack-plugin.
I was using this:
webpack --version
webpack 5.56.0
webpack-cli 4.8.0
webpack-dev-server 4.3.0
And now I'm using this:
webpack --version
webpack: 5.60.0
webpack-cli: 4.9.1
webpack-dev-server 4.3.1
Running with 'verbose' option I got this stacktrace. I can provide a complete build output but that is a lot of logging with multiple stacktraces like below. Let me know if you need more info.
ERROR in webpack/runtime/dojo-webpack-plugin
Cannot read property 'getChunkModules' of undefined
TypeError: Cannot read property 'getChunkModules' of undefined
at DojoAMDChunkTemplatePlugin.renderAbsMids (C:\Github\AuditCase\node_modules\dojo-webpack-plugin\lib\DojoAMDChunkTemplatePlugin.js:76:47)
at Hook.eval [as call] (eval at create (C:\Github\AuditCase\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:16)
at DojoAMDRuntimeModule.generate (C:\Github\AuditCase\node_modules\dojo-webpack-plugin\lib\DojoAMDRuntimeModule.js:39:44)
at DojoAMDRuntimeModule.getGeneratedCode (C:\Github\AuditCase\node_modules\webpack\lib\RuntimeModule.js:182:44)
at DojoAMDRuntimeModule.codeGeneration (C:\Github\AuditCase\node_modules\webpack\lib\RuntimeModule.js:137:30)
at C:\Github\AuditCase\node_modules\webpack\lib\Compilation.js:3267:22
at C:\Github\AuditCase\node_modules\webpack\lib\Cache.js:93:5
at Hook.eval [as callAsync] (eval at create (C:\Github\AuditCase\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
at Cache.get (C:\Github\AuditCase\node_modules\webpack\lib\Cache.js:75:18)
at ItemCacheFacade.get (C:\Github\AuditCase\node_modules\webpack\lib\CacheFacade.js:118:15)
at Compilation._codeGenerationModule (C:\Github\AuditCase\node_modules\webpack\lib\Compilation.js:3260:9)
at codeGen (C:\Github\AuditCase\node_modules\webpack\lib\Compilation.js:4766:11)
at symbolIterator (C:\Github\AuditCase\node_modules\neo-async\async.js:3482:9)
at timesSync (C:\Github\AuditCase\node_modules\neo-async\async.js:2297:7)
at Object.eachLimit (C:\Github\AuditCase\node_modules\neo-async\async.js:3463:5)
at C:\Github\AuditCase\node_modules\webpack\lib\Compilation.js:4831:15
CodeGenerationError: Cannot read property 'getChunkModules' of undefined
at C:\Github\AuditCase\node_modules\webpack\lib\Compilation.js:3275:18
at C:\Github\AuditCase\node_modules\webpack\lib\Cache.js:93:5
at Hook.eval [as callAsync] (eval at create (C:\Github\AuditCase\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
at Cache.get (C:\Github\AuditCase\node_modules\webpack\lib\Cache.js:75:18)
at ItemCacheFacade.get (C:\Github\AuditCase\node_modules\webpack\lib\CacheFacade.js:118:15)
at Compilation._codeGenerationModule (C:\Github\AuditCase\node_modules\webpack\lib\Compilation.js:3260:9)
at codeGen (C:\Github\AuditCase\node_modules\webpack\lib\Compilation.js:4766:11)
at symbolIterator (C:\Github\AuditCase\node_modules\neo-async\async.js:3482:9)
at timesSync (C:\Github\AuditCase\node_modules\neo-async\async.js:2297:7)
at Object.eachLimit (C:\Github\AuditCase\node_modules\neo-async\async.js:3463:5)
at C:\Github\AuditCase\node_modules\webpack\lib\Compilation.js:4831:15
at symbolIterator (C:\Github\AuditCase\node_modules\neo-async\async.js:3485:9)
at done (C:\Github\AuditCase\node_modules\neo-async\async.js:3527:9)
at C:\Github\AuditCase\node_modules\webpack\lib\Compilation.js:4778:8
at C:\Github\AuditCase\node_modules\webpack\lib\Compilation.js:3288:32
at C:\Github\AuditCase\node_modules\webpack\lib\HookWebpackError.js:68:3
2021-10-26 15:06:18: webpack 5.60.0 compiled with 90 errors in 29577 ms (89d90ef3386ec159a46e)
from dojo-webpack-plugin.
Question posted to stackoverflow
from dojo-webpack-plugin.
@ferrykranenburgcw - it would be helpful if you could determine the exact version of webpack that introduced this regression. Thanks.
from dojo-webpack-plugin.
Yes... well it looks like Webpack is not the root cause. Upgrading Webpack, cli and devserver works fine. We use npm-check-updates
to upgrade our dependencies and this time we had 20+ updates of various packages. So I upgraded them one-by-one until the error came back.
After a while I discovered this is caused by the plugin mini-css-extract-plugin. After we upgraded from version 2.3.0 to version 2.4.3 and this issue returns immediately.
To be exact: upgrading from 2.3.0 to 2.4.0 is the root cause of this issue.
from dojo-webpack-plugin.
This is how another plugin is retrieving the chunks: https://github.com/webpack-contrib/mini-css-extract-plugin/blob/b4431cb60a6eadcf8c2b614f494faf899c73aaa0/src/index.js#L487
from dojo-webpack-plugin.
This code is also referencing compilation.chunkGraph
on line 477. The error is occurring in dojo-webpack-plugin because compilation.chuckGraph is undefined. It's tough for me to debug because I don't know how to reproduce it. If you could provide a test case that reproduces the problem, that would be quite helpful.
from dojo-webpack-plugin.
@ferrykranenburgcw - you might try changing C:\Github\AuditCase\node_modules\dojo-webpack-plugin\lib\DojoAMDChunkTemplatePlugin.js:76 from:
const modules = this.compilation.chunkGraph.getChunkModules(chunk);
to
const modules = this.compilation.chunkGraph?.getChunkModules(chunk) || [];
to see if that resolves the problem.
from dojo-webpack-plugin.
The error changed to Cannot read property 'getModuleId' of undefined
. I'll try to setup a test case to reproduce it.
from dojo-webpack-plugin.
Ok, here it is. It is a stripped-down version of our large project, but just enough to reproduce the issue. Just run npm run dev
.
https://github.com/ferrykranenburgcw/dojo-webpack-plugin-347
from dojo-webpack-plugin.
Thanks, that was helpful. Please try release 3.0.3-rc1. The test case fails with 'HookWebpackError: self is not defined', but I think that's an issue with the test case rather than dojo-webpack-plugin.
from dojo-webpack-plugin.
Can you make 3.0.3-rc1
public?
from dojo-webpack-plugin.
@ferrykranenburgcw - not sure what you mean. The version is public. Just update the version of dojo-webpack-plugin in your package.json to 3.0.3-rc1
and run npm install
.
from dojo-webpack-plugin.
Ah my bad, it tried it.
Now I got two different stacktraces in our project
ReferenceError: self is not defined
at webpack/runtime/dojo-webpack-plugin:165:3
at webpack/runtime/dojo-webpack-plugin:240:3
at c:\Github\AuditCase\node_modules\webpack\lib\javascript\JavascriptModulesPlugin.js:460:11
at Hook.eval [as call] (eval at create (c:\Github\AuditCase\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:9:1)
at c:\Github\AuditCase\node_modules\webpack\lib\Compilation.js:4965:39
at tryRunOrWebpackError (c:\Github\AuditCase\node_modules\webpack\lib\HookWebpackError.js:83:7)
at __webpack_require_module__ (c:\Github\AuditCase\node_modules\webpack\lib\Compilation.js:4963:12)
at c:\Github\AuditCase\node_modules\webpack\lib\Compilation.js:4987:11
at symbolIterator (c:\Github\AuditCase\node_modules\neo-async\async.js:3485:9)
at timesSync (c:\Github\AuditCase\node_modules\neo-async\async.js:2297:7)
at Object.eachLimit (c:\Github\AuditCase\node_modules\neo-async\async.js:3463:5)
at c:\Github\AuditCase\node_modules\webpack\lib\Compilation.js:4863:16
at symbolIterator (c:\Github\AuditCase\node_modules\neo-async\async.js:3485:9)
at done (c:\Github\AuditCase\node_modules\neo-async\async.js:3527:9)
at c:\Github\AuditCase\node_modules\webpack\lib\Compilation.js:4778:8
at c:\Github\AuditCase\node_modules\webpack\lib\Compilation.js:3290:5
Generated code for webpack/runtime/dojo-webpack-plugin
1 | (function() { /* Start dojo-webpack-plugin extensions */
2 | function mix(dest, src) { // eslint-disable-line no-unused-vars
3 | for(var n in src) dest[n] = src[n];
.....
And this stacktrace:
webpack 5.60.0 compiled with 90 errors in 19132 ms
<e> [webpack-dev-middleware] <ref *1> Error: Can't locate C:\Users\ferry\AppData\Local\Temp\tmp-2208093Rv2VOTgMCg\dojo\dojo.js in compilation
<e> at DojoAMDRuntimeModule.getDojoLoaderModule (C:\Github\AuditCase\node_modules\dojo-webpack-plugin\lib\DojoAMDRuntimeModule.js:123:19)
<e> at DojoAMDRuntimeModule.generate (C:\Github\AuditCase\node_modules\dojo-webpack-plugin\lib\DojoAMDRuntimeModule.js:76:33)
<e> at DojoAMDRuntimeModule.getGeneratedCode (C:\Github\AuditCase\node_modules\webpack\lib\RuntimeModule.js:182:44)
<e> at DojoAMDRuntimeModule.updateHash (C:\Github\AuditCase\node_modules\webpack\lib\RuntimeModule.js:116:22)
<e> at Compilation._createModuleHash (C:\Github\AuditCase\node_modules\webpack\lib\Compilation.js:3875:10)
<e> at C:\Github\AuditCase\node_modules\webpack\lib\Compilation.js:4819:12
<e> at symbolIterator (C:\Github\AuditCase\node_modules\neo-async\async.js:3485:9)
<e> at done (C:\Github\AuditCase\node_modules\neo-async\async.js:3527:9)
<e> at C:\Github\AuditCase\node_modules\webpack\lib\Compilation.js:4778:8
<e> at C:\Github\AuditCase\node_modules\webpack\lib\Compilation.js:3290:5
<e> at C:\Github\AuditCase\node_modules\webpack\lib\Cache.js:93:5
<e> at Hook.eval [as callAsync] (eval at create (C:\Github\AuditCase\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:16:1)
<e> at Cache.get (C:\Github\AuditCase\node_modules\webpack\lib\Cache.js:75:18)
<e> at ItemCacheFacade.get (C:\Github\AuditCase\node_modules\webpack\lib\CacheFacade.js:118:15)
<e> at Compilation._codeGenerationModule (C:\Github\AuditCase\node_modules\webpack\lib\Compilation.js:3260:9)
<e> at codeGen (C:\Github\AuditCase\node_modules\webpack\lib\Compilation.js:4766:11) {
<e> module: DojoAMDRuntimeModule {
<e> dependencies: [],
<e> blocks: [],
<e> parent: undefined,
<e> type: 'runtime',
<e> context: null,
<e> layer: null,
<e> needId: true,
<e> debugId: 14018,
<e> resolveOptions: {},
<e> factoryMeta: undefined,
<e> useSourceMap: true,
<e> useSimpleSourceMap: false,
<e> _warnings: undefined,
<e> _errors: [ [Circular *1], [Error] ],
<e> buildMeta: {},
<e> buildInfo: {},
<e> presentationalDependencies: undefined,
<e> name: 'dojo-webpack-plugin',
<e> stage: 0,
<e> compilation: Compilation {
<e> hooks: [Object],
<e> name: undefined,
<e> startTime: undefined,
<e> endTime: undefined,
<e> compiler: [Compiler],
<e> resolverFactory: [ResolverFactory],
<e> inputFileSystem: [CachedInputFileSystem],
<e> fileSystemInfo: [FileSystemInfo],
<e> valueCacheVersions: [Map],
<e> requestShortener: [RequestShortener],
<e> compilerPath: '',
<e> logger: [WebpackLogger],
<e> options: [Object],
<e> outputOptions: [Object],
<e> bail: false,
<e> profile: false,
<e> params: [Object],
<e> mainTemplate: [MainTemplate],
<e> chunkTemplate: [ChunkTemplate],
<e> runtimeTemplate: [RuntimeTemplate],
<e> moduleTemplates: [Object],
<e> moduleMemCaches: undefined,
<e> moduleMemCaches2: undefined,
<e> moduleGraph: [ModuleGraph],
<e> chunkGraph: [ChunkGraph],
<e> codeGenerationResults: [CodeGenerationResults],
<e> processDependenciesQueue: [AsyncQueue],
<e> addModuleQueue: [AsyncQueue],
<e> factorizeQueue: [AsyncQueue],
<e> buildQueue: [AsyncQueue],
<e> rebuildQueue: [AsyncQueue],
<e> creatingModuleDuringBuild: [WeakMap],
<e> entries: [Map],
<e> globalEntry: [Object],
<e> entrypoints: [Map],
<e> asyncEntrypoints: [],
<e> chunks: [Set],
<e> chunkGroups: [Array],
<e> namedChunkGroups: [Map],
<e> namedChunks: [Map],
<e> modules: [Set],
<e> _modules: [Map],
<e> records: [Object],
<e> additionalChunkAssets: [Array],
<e> assets: [Object],
<e> assetsInfo: [Map],
<e> _assetsRelatedIn: [Map],
<e> errors: [Array],
<e> warnings: [],
<e> children: [],
<e> logging: [Map],
<e> dependencyFactories: [Map],
<e> dependencyTemplates: [DependencyTemplates],
<e> childrenCounters: {},
<e> usedChunkIds: Set(0) {},
<e> usedModuleIds: Set(0) {},
<e> needAdditionalPass: false,
<e> _restoredUnsafeCacheModuleEntries: [Set],
<e> _restoredUnsafeCacheEntries: [Map],
<e> builtModules: [WeakSet],
<e> codeGeneratedModules: [WeakSet],
<e> buildTimeExecutedModules: [WeakSet],
<e> _rebuildingModules: Map(0) {},
<e> emittedAssets: Set(0) {},
<e> comparedForEmitAssets: Set(0) {},
<e> fileDependencies: [LazySet],
<e> contextDependencies: [LazySet],
<e> missingDependencies: [LazySet],
<e> buildDependencies: [LazySet],
<e> compilationDependencies: [Object],
<e> _modulesCache: [CacheFacade],
<e> _assetsCache: [CacheFacade],
<e> _codeGenerationCache: [CacheFacade],
<e> _unsafeCache: true,
<e> _unsafeCachePredicate: [Function (anonymous)],
<e> fullHash: 'd0f33f341182c2d32f2d5e5652b1543a',
<e> hash: 'd0f33f341182c2d32f2d'
<e> },
<e> chunk: Chunk {
<e> id: 'build time chunk',
<e> ids: [Array],
<e> debugId: 1151,
<e> name: 'build time chunk',
<e> idNameHints: [SortableSet [Set]],
<e> preventIntegration: false,
<e> filenameTemplate: undefined,
<e> _groups: [SortableSet [Set]],
<e> runtime: 'build time',
<e> files: SetDeprecatedArray(0) [Set] {},
<e> auxiliaryFiles: Set(0) {},
<e> rendered: false,
<e> hash: undefined,
<e> contentHash: [Object: null prototype] {},
<e> renderedHash: undefined,
<e> chunkReason: undefined,
<e> extraAsync: false
<e> },
<e> chunkGraph: ChunkGraph {
<e> _modules: [WeakMap],
<e> _chunks: [WeakMap],
<e> _blockChunkGroups: [WeakMap],
<e> _runtimeIds: Map(0) {},
<e> moduleGraph: [ModuleGraph],
<e> _hashFunction: 'md4',
<e> _getGraphRoots: [Function: bound _getGraphRoots]
<e> },
<e> fullHash: false,
<e> dependentHash: false,
<e> _cachedGeneratedCode: undefined,
<e> pluginProps: {
<e> hooks: [Object],
<e> options: [Object],
<e> dojoRequire: [Getter],
<e> dojoLoader: [Getter],
<e> dojoLoaderFilename: [Getter],
<e> embeddedLoader: [Getter],
<e> embeddedLoaderFilename: [Getter],
<e> embeddedLoaderHasConfigApi: [Getter]
<e> },
<e> options: {
<e> noConsole: true,
<e> loaderConfig: [Function: getConfig],
<e> environment: [Object],
<e> buildEnvironment: [Object],
<e> locales: [Array],
<e> requireFnPropName: 'dj',
<e> getGlobalContext: [Function: bound getGlobalContext],
<e> isSkipCompilation: [Function: bound isSkipCompilation],
<e> ignoredCompilationNames: [Array],
<e> loader: 'C:\\Users\\ferry\\AppData\\Local\\Temp\\tmp-2208093Rv2VOTgMCg\\dojo\\dojo.js'
<e> }
<e> }
<e> }
from dojo-webpack-plugin.
OK, try 3.0.3-rc2
At least the test case builds clean for me now.
from dojo-webpack-plugin.
This works fine now. Both dev and production builds run without issues. Thanks!
from dojo-webpack-plugin.
Release 3.0.3 has been published to npm
from dojo-webpack-plugin.
Related Issues (20)
- Incompatibility with Html-webpack-plugin >=4 HOT 8
- Cannot read property 'registerAbsMids' of undefined HOT 3
- Export a dojo-based bundle as a library HOT 15
- Using typescript for i18n
- Webpack 5 support HOT 6
- Documentation for Dojo-On-Dojo Plugins
- Dojo layer file doesn't show the content HOT 2
- Splitting applications into multiple bundles HOT 5
- webpack-hasjs-plugin does not appear to work with 3.0.0-rc1 HOT 4
- dojo/has missing after update to 3.0.0 HOT 6
- SyntaxError: Unexpected token '.' after upgrading to Webpack 5 HOT 1
- dojo.js:56 [HMR] Update check failed: Error: __webpack_require__.dj name collision. HOT 3
- Only running karma test, [email protected] DojoAMDMainTemplate.runtime.js::resolveTernaryHasExpression() throws "Module not found: dojo/has" error HOT 10
- Mac webpack build error using [email protected] DojoAMDResolverPlugin.js HOT 2
- Location is undefined HOT 8
- Performance optimization: Add option to skip exporting module-name to webpack-id mappings for non-AMD modules HOT 1
- Better dojo/text! loader replacement for JSON files HOT 7
- Error in DojoAMDRuntimeModule.generate() when used with MonacoEditorWebpackPlugin
- Tapable peer dependency HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dojo-webpack-plugin.