extract-css-chunks-webpack-plugin: Throws when compiling (recording phase): "Path variable [name] not implemented in this context"
I tried upgrading by code from 1.x to 2.x. Unfortunately it does not work that well out of the box.
Stack Trace:
/Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/webpack/lib/TemplatedPathPlugin.js:71
.replace(REGEXP_NAME, getReplacer(chunkName))
^
Error: Path variable [name] not implemented in this context: [name].css
at /Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/webpack/lib/TemplatedPathPlugin.js:48:26
at String.replace (<anonymous>)
at MainTemplate.replacePathVariables (/Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/webpack/lib/TemplatedPathPlugin.js:71:4)
at MainTemplate.applyPluginsWaterfall (/Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/tapable/lib/Tapable.js:91:24)
at Compilation.getPath (/Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/webpack/lib/Compilation.js:1283:28)
at /Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/extract-css-chunks-webpack-plugin/index.js:360:22
at getFile (/Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/extract-css-chunks-webpack-plugin/index.js:355:49)
at ExtractTextPlugin.<anonymous> (/Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/extract-css-chunks-webpack-plugin/index.js:338:17)
at Array.forEach (native)
at ExtractTextPlugin.<anonymous> (/Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/extract-css-chunks-webpack-plugin/index.js:326:20)
at Compilation.applyPluginsAsyncSeries (/Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/tapable/lib/Tapable.js:142:13)
at sealPart2 (/Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/webpack/lib/Compilation.js:636:9)
at next (/Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/tapable/lib/Tapable.js:138:11)
at Compilation.compilation.plugin (/Users/Sebastian/Workspace/sebastian-software/edge-builder/src/plugins/VerboseProgress.js:1:2270)
at next (/Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/tapable/lib/Tapable.js:140:14)
at ExtractTextPlugin.<anonymous> (/Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/extract-css-chunks-webpack-plugin/index.js:301:5)
at /Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/async/dist/async.js:421:16
at iteratorCallback (/Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/async/dist/async.js:998:13)
at /Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/async/dist/async.js:906:16
at /Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/extract-css-chunks-webpack-plugin/index.js:284:6
at /Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/async/dist/async.js:421:16
at iteratorCallback (/Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/async/dist/async.js:998:13)
at /Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/async/dist/async.js:906:16
at /Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/extract-css-chunks-webpack-plugin/index.js:274:9
at rebuilding.forEach.cb (/Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/webpack/lib/Compilation.js:504:29)
at Array.forEach (native)
at callback (/Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/webpack/lib/Compilation.js:504:15)
at processModuleDependencies (/Users/Sebastian/Workspace/sebastian-software/edge-builder/node_modules/webpack/lib/Compilation.js:523:5)
My configuration is pretty straightforward for the plugin:
isClient ? new ExtractCssChunks({
filename: isDevelopment ? "[name].css" : "[name].[contenthash:base62:8].css"
}) : null,
Do you have any idea why this is happening?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 73 (57 by maintainers)
I am watching this PR, too 😃
yea, you need to provide the options still. react-loadable’s latest babel plugin replaces the need for all that.
…truth is, another plugin that does what dual-import does and what react-loadable’s babel plugin does is coming out any day now:
https://github.com/faceyspacey/babel-plugin-universal-import
and a few other things. FYI, if you get what you have working, the transition will be seamless.
…dont try to use that plugin. it requires the @next dist-tag of react-universal-component. u could, but i gotta revisit before i launch. it’s been sitting on the vine for a while. there’s actually a PR to webpack i’m working on pushing through to make dynamic imports work universally. things are about to come together nicely.
Regarding these missing chunk names/ids: I figure it would be useful to throw instead of producing a breaking build.
Pseudo pull-request 😉
…if you’re using a babel feature to strip comments, you will have this issue, as it will remove the magic comment:
https://github.com/faceyspacey/babel-plugin-dual-import/issues/1#issuecomment-313891179
That could be it.