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

TypeError: Cannot read property 'descriptionFileRoot' of undefined #51

Closed
shurygindv opened this issue Nov 23, 2019 · 11 comments
Closed
Assignees
Labels

Comments

@shurygindv
Copy link

shurygindv commented Nov 23, 2019

Hi! Thank you for the great plugin letting us make (IT, world) more progressive! But. I came across the next problems:

  1. ERROR in .?babel-target=legacy Module not found: TypeError: Cannot read property 'descriptionFileRoot' of undefined @ .?babel-target=legacy 8:14-39

Reproducable repo: https://github.com/shurygindv/reproducable-babel-multi-target

  1. I can't find the bottleneck of this problem, but I have only such message (uses awesome-ts-loader, without options,tsconfig has target esnext)

ERROR in ./src/components/A.tsx?babel-target=legacy Module not found: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type boolean

p.s I'm sure module presents there and it pretty works without plugin

@shurygindv
Copy link
Author

any ideas? let me hope that it may be fixed... or right way is to fork this repo and write own bike

@DanielSchaffer
Copy link
Owner

Hi there! Looks like this is a bug in how modules loaded via require.context are handled. I'll have to do a little digging to figure out specifically what's going on.

@DanielSchaffer DanielSchaffer self-assigned this Nov 30, 2019
@DanielSchaffer
Copy link
Owner

DanielSchaffer commented Nov 30, 2019

@shurygindv Looks like this was a pretty easy fix - try v2.3.3-next.2

@shurygindv
Copy link
Author

shurygindv commented Dec 1, 2019

@DanielSchaffer, thank you so much! an error seems disappeared, but I haven't tried runtime yet, as there is (2) problem, as mentioned before in a post, could you help?

In my opinion 1 line on 14 position looks good, need your eagle-eyed...

Capture

p.s sorry, I didn't find out a feature to hide it in spoiler;

@DanielSchaffer
Copy link
Owner

Looks like there's some sort of compatibility issue with bloodhound-js. It's possible there's some sort of conflict if there's a dependency on es6-promise, since Promises would be polyfilled by Babel/core-js separately. I'll see if I can track it down.

@shurygindv
Copy link
Author

shurygindv commented Dec 1, 2019

ok, thx) also I have similar errors with local UI modern components (.tsx files) (self-writеtten by the team) + bloodhound, damn it! I had spoken my team why we need so legacy pkg

@DanielSchaffer
Copy link
Owner

DanielSchaffer commented Dec 2, 2019

Okay, figured it out - es6-promise had some data in their package.json in a format I wasn't expecting - a false value in the browser object (used to ignore a file - see https://github.com/defunctzombie/package-browser-field-spec#ignore-a-module). I've added code to correctly handle that now.

I was also seeing some weird behavior with @babel/preset-env and core-js, which I solved by setting the default options for @babel/preset-env to use core-js version 2.

Try 2.3.3-next.3.

Just a heads up that this plugin is set up to use Babel with preset-env set to useBuiltins: 'usage' - which means that given your browser targets, it will automatically add polyfills as they're needed. This could mean that for legacy browsers you'd end up with Promise polyfills from both es6-promise, as it's included explicitly in that dependency's code, and from core-js, when it's injected by Babel. At best, it's a waste of bytes in your bundle - at worst, there could be some weird side effects due to conflicting polyfills. I'd recommend researching if there's a way to avoid loading that es6-promise polyfill - possibly by either using an alternate package which does not include it, or maybe even by using a resolve setting in your Webpack config to prevent it from getting loaded.

@DanielSchaffer
Copy link
Owner

DanielSchaffer commented Dec 2, 2019

It looks like bloodhound isn't even maintained any more - it hasn't seen a commit in over 4 1/2 years. It might be better idea to find an alternative package or method. Are you using any frontend framework (Angular, React, Vue, etc)?

@shurygindv
Copy link
Author

shurygindv commented Dec 2, 2019

@DanielSchaffer, yes, we use React + TypeScript (awesome-ts-loader), the bloodhound is an echo from a previous, legacy stack; we had a short time and cup of tea to integrate all codebase on a new modern stack, but right now I initiate the process to replace this package

@shurygindv
Copy link
Author

shurygindv commented Dec 2, 2019

@DanielSchaffer, gracious 💃 ! finally, I can bundle without errors, it's a magic fix (+ I'll set corejs on '3' version). Thank you!

p.s modern/legacy bundle pretty works in runtime
p.s when do you plan to release a new version of the plugin?)

@DanielSchaffer
Copy link
Owner

This is now released in 2.3.3

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

No branches or pull requests

2 participants