istarkov / babel-plugin-webpack-loaders

babel 6 plugin which allows to use webpack loaders
623 stars 43 forks source link

Recursion in resolving #38

Open MoOx opened 8 years ago

MoOx commented 8 years ago

I am currently replacing some old node code build by webpack by your plugin and got this weird error (I have no idea how to fix it as I am writing this). I am seeing that your are using "enhanced-resolve", but I am also seeing that this module is unmaintained (per description https://github.com/webpack/enhanced-require at the top of the page).

The module that seems to create a recursion is the resolution of the "github" package, no idea why this one...

Any idea?

❯❯ BABEL_DISABLE_CACHE=1 npms

> putaindecode.io@ start /Users/MoOx/Sync/Development/putaindecode.io
> npm run statinamic --server --open --dev

> putaindecode.io@ statinamic /Users/MoOx/Sync/Development/putaindecode.io
> cross-env BABEL_ENV=statinamic DEBUG=statinamic:* babel-node scripts/build

/Users/MoOx/Sync/Development/putaindecode.io/node_modules/babel-core/lib/transformation/file/index.js:585
      throw err;
      ^

Error: /Users/MoOx/Sync/Development/putaindecode.io/scripts/contributors/index.js: Recursion in resolving
Stack:
  resolve: (/Users/MoOx/Sync/Development/putaindecode.io/scripts/contributors) github
  parsed-resolve: (/Users/MoOx/Sync/Development/putaindecode.io/scripts/contributors) github module
  described-resolve: (/Users/MoOx/Sync/Development/putaindecode.io/scripts/contributors) github module
  raw-module: (/Users/MoOx/Sync/Development/putaindecode.io/scripts/contributors) github
  module: (/Users/MoOx/Sync/Development/putaindecode.io/scripts/contributors) github
  resolve: (/Users/MoOx/Sync/Development/putaindecode.io/node_modules) ./github
  parsed-resolve: (/Users/MoOx/Sync/Development/putaindecode.io/node_modules) ./github
  described-resolve: (/Users/MoOx/Sync/Development/putaindecode.io/node_modules) ./github
  relative: (/Users/MoOx/Sync/Development/putaindecode.io/node_modules/github) 
  described-relative: (/Users/MoOx/Sync/Development/putaindecode.io/node_modules/github) 
  directory: (/Users/MoOx/Sync/Development/putaindecode.io/node_modules/github) 
  existing-directory: (/Users/MoOx/Sync/Development/putaindecode.io/node_modules/github) 
  resolve: (/Users/MoOx/Sync/Development/putaindecode.io/node_modules/github) ./.
  parsed-resolve: (/Users/MoOx/Sync/Development/putaindecode.io/node_modules/github) ./.
  described-resolve: (/Users/MoOx/Sync/Development/putaindecode.io/node_modules/github) ./.
  relative: (/Users/MoOx/Sync/Development/putaindecode.io/node_modules/github) 
    at Tapable.doResolve (/Users/MoOx/Sync/Development/putaindecode.io/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/Resolver.js:90:25)
    at Tapable.<anonymous> (/Users/MoOx/Sync/Development/putaindecode.io/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/JoinRequestPlugin.js:21:12)
    at next (/Users/MoOx/Sync/Development/putaindecode.io/node_modules/babel-plugin-webpack-loaders/node_modules/tapable/lib/Tapable.js:117:14)
    at Tapable.<anonymous> (/Users/MoOx/Sync/Development/putaindecode.io/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/ModuleKindPlugin.js:17:30)
    at Tapable.applyPluginsAsyncSeriesBailResult1 (/Users/MoOx/Sync/Development/putaindecode.io/node_modules/babel-plugin-webpack-loaders/node_modules/tapable/lib/Tapable.js:119:13)
    at innerCallback (/Users/MoOx/Sync/Development/putaindecode.io/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/Resolver.js:123:19)
    at loggingCallbackWrapper (/Users/MoOx/Sync/Development/putaindecode.io/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at /Users/MoOx/Sync/Development/putaindecode.io/node_modules/babel-plugin-webpack-loaders/node_modules/tapable/lib/Tapable.js:210:15
    at Tapable.<anonymous> (/Users/MoOx/Sync/Development/putaindecode.io/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/ConcordModulesPlugin.js:25:28)
    at Tapable.applyPluginsParallelBailResult1 (/Users/MoOx/Sync/Development/putaindecode.io/node_modules/babel-plugin-webpack-loaders/node_modules/tapable/lib/Tapable.js:215:14)
``
MoOx commented 8 years ago

FYI, I "workedaround" by removing some code out for the transformation so it's not urgent by might be nice to have a clue :)

istarkov commented 8 years ago

The best of unmaintained modules their not change so fast :-) Today we upgrade eslint and airnbnb config (just 6 month old) just 3500+ eslint errors. (Last years I wrote on C++, my lovest library boost, I've never did any change in existing code)

PS: I'll think about what what to do this such situation.

istarkov commented 8 years ago

Want to say boost is superfast changing library in C++ world, but looks like js world is mad.

daniellacosse commented 8 years ago

Hey! I'm trying to integrate AVA/webpack into our stack and so naturally that path lead me here. I'm running into a similar issue where our resolver is modularizing all our level folders. Because of this issue the files in those folders can't require other files (their siblings) from the same folder. So for example, for the following file structure:

webpack.config.js
\node_modules
\app
∟\etc
∟\src
  ∟\components
  ∟\containers

I've got the following resolve config:

// webpack.config.js
// ...

root: [
  path.resolve('./node_modules')
],
fallback: [
  path.resolve('./src')
],
extensions: ['', '.json', '.js', '.jsx']

And, while I can do the following in a container and babel-plugin-webpack-loaders seems to resolve the 'components' module here:

// containers/App.jsx

import { DraggableSlider } from 'components';

Attempting to import other subsequent components inside the DraggableSlider component (e.g. like import { Draggable, DragState } from 'components';) results in the following error:

Error: ~/app/src/components/DraggableSlider/DraggableSlider.js: Can't resolve 'components' in '~/app/src/components/DraggableSlider'
    at onResolved (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/Resolver.js:64:16)
    at loggingCallbackWrapper (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at afterInnerCallback (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/Resolver.js:136:10)
    at loggingCallbackWrapper (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at Tapable.applyPluginsAsyncSeriesBailResult1 (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/tapable/lib/Tapable.js:108:46)
    at innerCallback (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/Resolver.js:123:19)
    at loggingCallbackWrapper (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at ~/app/node_modules/babel-plugin-webpack-loaders/node_modules/tapable/lib/Tapable.js:210:15
    at innerCallback (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/Resolver.js:121:11)
    at loggingCallbackWrapper (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at ~/app/node_modules/babel-plugin-webpack-loaders/node_modules/tapable/lib/Tapable.js:210:15
    at ~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:45:5
    at loggingCallbackWrapper (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at afterInnerCallback (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/Resolver.js:134:11)
    at loggingCallbackWrapper (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at next (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/tapable/lib/Tapable.js:112:35)
    at ~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/ModuleKindPlugin.js:24:4
    at loggingCallbackWrapper (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at afterInnerCallback (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/Resolver.js:136:10)
    at loggingCallbackWrapper (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at Tapable.applyPluginsAsyncSeriesBailResult1 (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/tapable/lib/Tapable.js:108:46)
    at innerCallback (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/Resolver.js:123:19)
    at loggingCallbackWrapper (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at ~/app/node_modules/babel-plugin-webpack-loaders/node_modules/tapable/lib/Tapable.js:210:15
    at afterInnerCallback (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/Resolver.js:136:10)
    at loggingCallbackWrapper (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at Tapable.applyPluginsAsyncSeriesBailResult1 (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/tapable/lib/Tapable.js:108:46)
    at innerCallback (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/Resolver.js:123:19)
    at loggingCallbackWrapper (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at ~/app/node_modules/babel-plugin-webpack-loaders/node_modules/tapable/lib/Tapable.js:210:15
    at ~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/forEachBail.js:29:14
    at ~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/ModulesInHierachicDirectoriesPlugin.js:43:12
    at SyncNodeJsInputFileSystem.stat (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/SyncNodeJsInputFileSystem.js:21:4)
    at ~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/ModulesInHierachicDirectoriesPlugin.js:32:7
    at forEachBail (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/forEachBail.js:12:3)
    at Tapable.<anonymous> (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/ModulesInHierachicDirectoriesPlugin.js:31:3)
    at Tapable.applyPluginsParallelBailResult1 (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/tapable/lib/Tapable.js:215:14)
    at beforeInnerCallback (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/Resolver.js:110:19)
    at loggingCallbackWrapper (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at Tapable.applyPluginsAsyncSeriesBailResult1 (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/tapable/lib/Tapable.js:108:46)
    at Tapable.doResolve (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/Resolver.js:98:11)
    at Tapable.<anonymous> (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/TryNextPlugin.js:18:12)
    at Tapable.applyPluginsParallelBailResult1 (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/tapable/lib/Tapable.js:215:14)
    at beforeInnerCallback (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/Resolver.js:110:19)
    at loggingCallbackWrapper (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at Tapable.applyPluginsAsyncSeriesBailResult1 (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/tapable/lib/Tapable.js:108:46)
    at Tapable.doResolve (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/Resolver.js:98:11)
    at Tapable.<anonymous> (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/ModuleKindPlugin.js:20:12)
    at Tapable.applyPluginsAsyncSeriesBailResult1 (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/tapable/lib/Tapable.js:119:13)
    at innerCallback (~/app/node_modules/babel-plugin-webpack-loaders/node_modules/enhanced-resolve/lib/Resolver.js:123:19)
    at loggingCallbackWrapper (~/app/node_modules/babel-plugin-webpack-loaders/node_modules