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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

ember-auto-import breaks assets rewriting #94

Closed
lucacorti opened this issue Aug 8, 2018 · 6 comments
Closed

ember-auto-import breaks assets rewriting #94

lucacorti opened this issue Aug 8, 2018 · 6 comments

Comments

@lucacorti
Copy link

Hi,

When fingerprint prepend is set and ember-auto-import >= 1.2.7 is installed, the asset rewriter receives an invalid path and breaks the build:

Error: Build Canceled: Broccoli Builder ran into an error with `AssetRewrite` plugin. 馃挜 Cannot read property '2' of null TypeError: Cannot read property '2' of null at AssetRewrite.rewriteAssetPath (node_modules/broccoli-asset-rewrite/index.js:127:91) at AssetRewrite.processString (node_modules/broccoli-asset-rewrite/index.js:167:24) at AssetRewrite.processFile (node_modules/broccoli-filter/index.js:165:31) at asyncProcessFile (node_modules/broccoli-filter/index.js:122:21) at tryCatch (node_modules/rsvp/dist/rsvp.js:525:12) at invokeCallback (node_modules/rsvp/dist/rsvp.js:538:13) at node_modules/rsvp/dist/rsvp.js:606:14 at flush (node_modules/rsvp/dist/rsvp.js:2415:5) at process._tickCallback (internal/process/next_tick.js:61:11)Pipeline aborted

Pinning ember-auto-import to 1.2.6 solves the problem.

@lucacorti lucacorti changed the title ember-auto-import breaks assets rewriting ember-auto-import breaks assets rewriting Aug 8, 2018
@ef4
Copy link
Collaborator

ef4 commented Aug 8, 2018

I can't reproduce. What packages are you trying to auto import?

Also, can you put a breakpoint or console.log at the site of the exception and tell me the values of replaceString and this.prepend?

@lucacorti
Copy link
Author

lucacorti commented Aug 8, 2018

I'm not pulling in auto import directly, it is pulled in by ember-intl which is my dependency. I did some debug but don't have it at hand right know. I'll provide it asap but IIRC at some point replaceString contained something along the lines of 'var ember_auto_import'.

@lucacorti
Copy link
Author

lucacorti commented Aug 9, 2018

This is the console log of replaceString and this.prepend:

this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: assets/@dwind/wwwind/images/logo-da6d2a9356cee60515e97eec68f94fb2.svg
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/@dwind/wwwind/images/landing/fmc/landing-fibra-1000_icona_modem_incluso-a9eba6c51f41df5ed6b016f463ea662c.svg
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/@dwind/wwwind/images/landing/fmc/landing-fibra-1000_icona_giga_edition-daf7dea32164cd78459da20512d46152.svg
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/@dwind/wwwind/images/landing/fmc/landing-fibra-1000_icona_best_speed-63c7f5658f6852b34d0f330fac605b2d.svg
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/@dwind/wwwind/images/landing/fmc/landing-fibra-1000_icona_fibra_pass-eb21e7800e43e2d004eefb5ad0706d2e.svg
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/@dwind/wwwind/images/logo_small-c15e84ccb6c2a969a5cd09d591262595.svg\
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/@dwind/wwwind/images/logo-da6d2a9356cee60515e97eec68f94fb2.svg\
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: ember-welcome-page/images/construction-9fa193741d5b8f6f2964178d3c75dea1.png\
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: assets/vendor-f3d610c0ba8487cb6ec8cc5825906495.map

var __ember_auto_import__
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/

The last replaceString looks odd, while on 1.2.6 everything looks good:

this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: assets/@dwind/wwwind/images/logo-da6d2a9356cee60515e97eec68f94fb2.svg
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/@dwind/wwwind/images/landing/fmc/landing-fibra-1000_icona_modem_incluso-a9eba6c51f41df5ed6b016f463ea662c.svg
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/@dwind/wwwind/images/landing/fmc/landing-fibra-1000_icona_giga_edition-daf7dea32164cd78459da20512d46152.svg
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/@dwind/wwwind/images/landing/fmc/landing-fibra-1000_icona_best_speed-63c7f5658f6852b34d0f330fac605b2d.svg
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/@dwind/wwwind/images/landing/fmc/landing-fibra-1000_icona_fibra_pass-eb21e7800e43e2d004eefb5ad0706d2e.svg
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/@dwind/wwwind/images/landing/fmc/landing-fibra-1000_visore_desktop-43585cb87e31a94f561462b122b630f5.jpg
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/@dwind/wwwind/images/landing/fmc/landing-fibra-1000_visore_mobile-655a7cd81d057eed5c8f88e1a44fe16b.jpg
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/@dwind/wwwind/images/logo_small-c15e84ccb6c2a969a5cd09d591262595.svg\
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/@dwind/wwwind/images/logo-da6d2a9356cee60515e97eec68f94fb2.svg\
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: ember-welcome-page/images/construction-9fa193741d5b8f6f2964178d3c75dea1.png\
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: ./tmp/ember_auto_import_webpack-staging_dir-dsBo8IGR.tmp/assets/tests-2ac05ec0d7b8fa326d22c06a79be6566.js
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/@dwind/wwwind-67246a14846a06fc99fd02ed484bcbe5.css
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/@dwind/wwwind-cc183c712221b6adcf6406f2dcc3d8d1.js
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/vendor-98e6a85174a8bf812ea947254c94af2c.css
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/vendor-a04b5376dd7caa9f23a4d8a3f7915dfc.js
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/@dwind/wwwind-67246a14846a06fc99fd02ed484bcbe5.css
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/@dwind/wwwind-cc183c712221b6adcf6406f2dcc3d8d1.js
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/test-support-e10fa870c88a40bb68282a9d5e67faf1.css
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/test-support-4b8feba1852a0c0ebec0aa541fc35c61.js
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/vendor-98e6a85174a8bf812ea947254c94af2c.css
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/vendor-a04b5376dd7caa9f23a4d8a3f7915dfc.js
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: /assets/tests-2ac05ec0d7b8fa326d22c06a79be6566.js
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/
replaceString: assets/tests-2ac05ec0d7b8fa326d22c06a79be6566.js
this.prepend: https://d33e4bguo4w0ix.cloudfront.net/

@ef4
Copy link
Collaborator

ef4 commented Aug 9, 2018

Thanks, that helped me find this: ember-cli/broccoli-asset-rewrite#65

That is the underlying cause.

@ef4
Copy link
Collaborator

ef4 commented Aug 9, 2018

When ember-cli/broccoli-asset-rewrite#64 is merged and released it will fix this issue.

You can probably workaround by disabling sourcemaps:

let app = new EmberApp(defaults, {
    sourcemaps: { enabled: false}
});

@sumeetattree
Copy link

I just ran into this issue with fingerprinting.enabled = true. Setting this to false makes the build succeed. This fails with "broccoli-asset-rewrite": "^1.1.0" but is fine on the "broccoli-asset-rewrite": "^2.0.0". But ember-cli: 3.8 does not ship with the latest version of asset-rewrite

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

No branches or pull requests

3 participants