embroider-build / embroider

Compiling Ember apps into spec-compliant, modern Javascript.
MIT License
330 stars 137 forks source link

Build error: "don't know how to insertURL /assets/undefined" #798

Closed simonihmig closed 3 years ago

simonihmig commented 3 years ago

After re-enabling embroider test scenarios in ember-bootstrap, I am getting this error in CI, also when adding the embroider dependencies locally to this PR (which could serve as a reproduction).

It has worked before, so this seems like a regression.

I debugged this a bit in node:

  1. the error is thrown in @embroider/webpack here

  2. in the previous step of the call stack, the match for assets/dummy.js seems pretty broken: Bildschirmfoto 2021-04-30 um 19 28 58

  3. Same when looking at stats.entrypoints map for assets/dummy.js (same for assets/tests.js): Bildschirmfoto 2021-04-30 um 19 32 03

Haven't investigated any further. Any idea?

ef4 commented 3 years ago

I think this is due to a wrong webpack version, see https://github.com/embroider-build/embroider/pull/791 and https://github.com/embroider-build/embroider/pull/792

Those are fixed on master but not yet released, I need to do a patch release soon.

NullVoxPopuli commented 3 years ago

confirm: I got this error yesterday in an addon and made it go away by manually adding webpack @v5 to my package.json

simonihmig commented 3 years ago

Those are fixed on master but not yet released, I need to do a patch release soon.

I could refer to the master branch of test-setup as an interim solution, but wonder if there is anything left blocking that release? (other than your personal time of course) Anything I/we can do?

mehulkar commented 3 years ago

Ran into the same thing with @embroider/test-setup (0.40.0)! Turns out that webpack@4 is coming from ember-auto-import, btw.

RobbieTheWagner commented 3 years ago

I'm experiencing this issue as well. I tried yarn add webpack -D and now my tests seem to just hang and throw errors like not ok 1 Chrome 90.0 - [undefined ms] - Global error: Uncaught ReferenceError: Ember is not defined at http://localhost:7357/assets/vendor.js, line 1027

ef4 commented 3 years ago

The main thing blocking release is that changes in (I think) ember-cli-babel have left a large swath of embroider's test suite falling.

knownasilya commented 3 years ago

Seeing the same issue with ember-page-title. Tried with auto-import v2 and get the same result as well. But an older version of auto-import might have been used since some deps don't use v2.

When using resolutions and setting auto-import to v2, I get this:

Cannot find module 'webpack'
Require stack:
- /Users/iradchenko/maintained/ember-page-title/node_modules/@embroider/webpack/src/ember-webpack.js
- /Users/iradchenko/maintained/ember-page-title/node_modules/@embroider/test-setup/src/index.js
- /Users/iradchenko/maintained/ember-page-title/ember-cli-build.js
- /Users/iradchenko/maintained/ember-page-title/node_modules/ember-cli/lib/utilities/find-build-file.js
- /Users/iradchenko/maintained/ember-page-title/node_modules/ember-cli/lib/models/builder.js
- /Users/iradchenko/maintained/ember-page-title/node_modules/ember-cli/lib/tasks/build-watch.js
- /Users/iradchenko/maintained/ember-page-title/node_modules/ember-cli/lib/utilities/require-as-hash.js
- /Users/iradchenko/maintained/ember-page-title/node_modules/ember-cli/lib/cli/index.js
- /Users/iradchenko/maintained/ember-page-title/node_modules/ember-cli/bin/ember

Stack Trace and Error Report: /var/folders/g5/dvq_p0010s5b2ys8bwd7czdr0000gp/T/error.dump.511adc0fe6cab062cdaf1a7054ca8ab9.log

Looks like #792 will fix this. Any ideas when this will be released?

knownasilya commented 3 years ago

0.41.0 fixes it for me with auto-import v1 in ember-page-title

simonihmig commented 3 years ago

Confirm. Fixed in 0.41.0!

RobbieTheWagner commented 3 years ago

Anyone know why tests would be hanging for embroider with errors like this?

not ok 1 Chrome 90.0 - [undefined ms] - Global error: Uncaught ReferenceError: Ember is not defined at http://localhost:7357/assets/vendor.js, line 1027
    ---
        browser log: |
            {"type":"error","text":"Uncaught ReferenceError: Ember is not defined at http://localhost:7357/assets/vendor.js, line 1027\n","testContext":{}}
    ...
not ok 2 Chrome 90.0 - [undefined ms] - Global error: Uncaught Error: Could not find module `velocity` imported from `(require)` at http://localhost:7357/assets/vendor.js, line 256

They run for hours and never time out, so I cancel them, and then I see these types of errors. See this PR https://github.com/shipshapecode/ember-shepherd/pull/779

knownasilya commented 3 years ago

@rwwagner90 sounds like you need to use skipBabel setting for velocity maybe? https://github.com/embroider-build/embroider/issues/677#issuecomment-813118275

RobbieTheWagner commented 3 years ago

@knownasilya I tried that in https://github.com/shipshapecode/ember-shepherd/pull/779 and it still seems to hang with the same error. @ef4 any ideas here?