Closed jamesAtcodeninja closed 6 years ago
I just tested using the sample-project
, the bundle was built successfully. What version of enhanced-resolve
are you using? Any other info that you can provide so I can diagnose?
I am getting the same error:
TypeError: resolver.ensureHook is not a function
at module.exports.doApply (/tst/node_modules/directory-named-webpack-plugin/index.js:23:25)
at webpack (/tst/node_modules/webpack/lib/webpack.js:37:12)
at Promise (/tst/tools/tasks/compiler.js:51:14)
at new Promise (<anonymous>)
at compiler (/tst/tools/tasks/compiler.js:48:9)
at startBuild (/tst/tools/run.js:57:3)
at <anonymous>
compiler.js
and run.js
are project files that run each other and webpack.
I have node 8.11.1
, npm 6.0.1
, webpack 4.8.3
, enhanced-resolve 4.0.0
Are you able to post your webpack config file? Just the part where you setup this plugin. Do you set it up as a plugin for webpack? I suspect that's the case from the stack tract provided although I could be wrong. This is a plugin of webpack's resolver, so it needs to be set up as a resolver plugin
resolve: {
plugins: [
new DirectoryNamedWebpackPlugin()
]
}
You're right, I originally had it set up as a plugin. But now I'm getting another error after setting it up as a resolve plugin -
Cannot read property 'normalModuleFactory' of undefined
from [webpack]/lib/IgnorePlugin.js:62:18
while using
node v8.10.0
, npm 5.6.0
webpack: 4.8.3
, enhanced-resolve: 4.0.0
, directory-named-webpack-plugin: 4.0.0
Thanks for the help.
Same here 😊 Thanks for your help. This can be closed I guess.
Hi! It may be related, I'm not really sure if its a problem of storybook, but when used Directory Named Webpack, in conjunction with Storybook, I', getting the same issue. I'm adding it as. a resolve plugin though.
C:\...\node_modules\directory-named-webpack-plugin\index.js:23
var target = resolver.ensureHook("undescribed-raw-file");
^
TypeError: resolver.ensureHook is not a function
at module.exports.doApply (C:\...\node_modules\directory-named-webpack-plugin\index.js:23:25)
at Resolver.apply (C:\...\node_modules\@storybook\core\node_modules\tapable\lib\Tapable.js:375:16)
at C:\...\node_modules\@storybook\core\node_modules\enhanced-resolve\lib\ResolverFactory.js:249:12
at Array.forEach (<anonymous>)
at Object.exports.createResolver (C:\...\node_modules\@storybook\core\node_modules\enhanced-resolve\lib\ResolverFactory.js:248:10)
at WebpackOptionsApply.process (C:\...\node_modules\@storybook\core\node_modules\webpack\lib\WebpackOptionsApply.js:283:47)
at webpack (C:\...\node_modules\@storybook\core\node_modules\webpack\lib\webpack.js:37:48)
at exports.default (C:\...\node_modules\@storybook\core\dist\server\middleware.js:29:40)
at buildDev (C:\...\node_modules\@storybook\core\dist\server\build-dev.js:163:36)
at Object.<anonymous> (C:\...\node_modules\@storybook\react\dist\server\index.js:23:22)
Which version of Webpack
and enhanced-resolve
do you use? How do you use Storybook
? Do you just import Storybook
in one of your JS file? I'll try to see if I can reproduce, but if you can provide some more info, like your Webpack conf snippet or even a small sample project that has the issue if possible, would be very helpful. Thanks!
I'm using nuxt
and installing the plugin in the build property like so:
config.resolve.plugins = [ new DirectoryNamedWebpackPlugin()]
also getting the same error as @khaliu.
Hi sorry for the delay. Here is some info:
My configuration uses: Webpack: 4.6.0 (It uses enhanced-resolve 4.0.0) storybook/react: 3.4.3 directory-named-webpack-plugin: 4.0.0
and basically same config as @jamesAtcodeninja giving a custom webpack config to storybooks, it breaks when calling the Directory Named Webpack.
Thank you
I may found something, as I'm using Storybook webpack config, I checked which Webpack version it uses and I found: Webpack: 3.11.0 (Enhanced Resolve 3.4.1)
So, as My version of DNW is 4 isn't compatible with webpack 3.
@shaketbaby @jamesAtcodeninja It's working, installed Directory Named Webpack version 2, with yarn alias and using it only for storybook build works well.
Thanks!
I was going to say try that, but glad to hear things are working now.
I'm getting this error on
webpack: 4.8.3
anddirectory-named-webpack-plugin: 4.0.0