Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't resolve 'vertx' #305

Closed
luke-robertson opened this issue Sep 12, 2017 · 13 comments · Fixed by webcomponents/webcomponentsjs#903
Closed

Can't resolve 'vertx' #305

luke-robertson opened this issue Sep 12, 2017 · 13 comments · Fixed by webcomponents/webcomponentsjs#903

Comments

@luke-robertson
Copy link

luke-robertson commented Sep 12, 2017

iv tried doing the

new webpack.IgnorePlugin(/vertx/)

not working for me

Module not found: Error: Can't resolve 'vertx' in '/*******/node_modules/es6-promise/dist'
 @ ./node_modules/es6-promise/dist/es6-promise.js 138:16-26
 @ ./client/src/App.jsx
 @ ./client/src/routes.jsx
 @ ./client/src/index.jsx
 @ multi ./client/src/index
webpack: Compiled with warnings.```
@grzegorzjudas
Copy link

Got the same thing today

@stefanpenner
Copy link
Owner

new webpack.IgnorePlugin(/vertx/)

sounds like a webpack bug?

@beck3905
Copy link

@stefanpenner I just found this issue today. Any updates on a fix?

@hilongjw
Copy link

Looks like it's a problem here

function attemptVertx() {
  try {
    var r = require;
    var vertx = r('vertx');
    vertxNext = vertx.runOnLoop || vertx.runOnContext;
    return useVertxTimer();
  } catch (e) {
    return useSetTimeout();
  }
}

@pablohpsilva
Copy link

That's true. I'm getting the same issue here.
Still not getting what happened.

@stefanpenner
Copy link
Owner

stefanpenner commented Dec 10, 2017

Still not getting what happened.

@pablohpsilva webpack appears to not respect browserifies browser field in this projects package.json. Yes webpack is not browserify, but it either should support this how provide some alternative (ideally support).

es6-promise/package.json

Lines 53 to 55 in e1bb7b6

"browser": {
"vertx": false
},

@TheLarkInn is it intended for webpack to not support this? I suspect if it did, it would support even more browserify-safe packages. If not, is there another configuration based approach which could be used?

Alternatively, is there some heuristic we can rely on to require but without webpack getting confused?

@stefanpenner
Copy link
Owner

@TheLarkInn friendly ping

@stefanpenner
Copy link
Owner

stefanpenner commented Dec 19, 2017

I think package.js may be used for this, must investigate further (moment.js has this...)

@stefanpenner
Copy link
Owner

stefanpenner commented Jan 23, 2018

So, I gave this a whirl. But am unable to reproduce. Here is my attempt: https://github.com/stefanpenner/test-es6-promise-webpack

If someone can help make my reproduction fail, I can likely configure webpack appropriately, more then likely via:

// webpack.config.js
module.exports = {
  externals: {
    vertex: /** magic **/
  }
}

Unfortunately without reproduction, I have no way to confirm. So if ya'll can help me with ^, I'll land the fix.

@stefanpenner
Copy link
Owner

I was able to reproduce, required --target=node to my reproduction

@gregory
Copy link

gregory commented Sep 27, 2018

i just had the same issue & figured out what was going on.
I have the following structure:

/project:
  /package.json
  /fileA.js -> require('some_lib')
  /subProject
    package.json
    /fileB.js -> require('../fileA.js')

when webpack was compiling subproject, it noticed i was requiring an external dependency & throwed the vertex the warning.
I solved by changing the logic in fileA to inject the dependencies.
so fileA looks like this:

module.exports = ({some_lib}) => (params) => logic

and file B like this:

const some_lib = require('some_lib')
const fileA = require('../fileA.js');
module.exports = params => fileA({some_lib})(params)

@pablohpsilva
Copy link

Hello everyone. I solved my issue with this lib in some different way. Since I was creating a lib, I moved from webpack to rollup and instead of importing the webcomponent package (this package was my original problem where I ended up here on this issue) I imported in my project just the files I needed and used another es6-promise polyfill.

But this error is super annoying.

@SirMishaa
Copy link

Hello there, I have the same issue with auth0-js (auth0/auth0.js#1250), does anyone know how I can fix it? I'm migrating from vue-cli-service to Vite (rollup) for work.

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants