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

Webpack plugin replaces "prod" with "dev" in output path and fails. #1478

Closed
freezy opened this issue May 8, 2018 · 2 comments
Closed

Webpack plugin replaces "prod" with "dev" in output path and fails. #1478

freezy opened this issue May 8, 2018 · 2 comments

Comments

@freezy
Copy link

freezy commented May 8, 2018

Library Affected:
workbox-webpack-plugin 3.2.0

Browser & Platform:
Linux, Node 8.11.1

Issue or Feature Request Description:
I'm building on my production server under a path that has production in it and for some reason Workbox replaces "prod" with "dev", resulting in "devuction", which obviously doesn't exist, and fails. The origin seems to be here.

The error looks like that:

 95% emitting GenerateSWError: One or more of the Workbox libraries could not be copied over to the destination directory: Error: ENOENT: no such file or directory, lstat '/var/www/website/devuction/v2.0.0/node_modules/workbox-background-sync/build/workbox-background-sync.prod.js'
    at _callee$ (/var/www/website/production/v2.0.0/node_modules/workbox-build/build/lib/copy-workbox-libraries.js:227:19)
    at tryCatch (/var/www/website/production/v2.0.0/node_modules/regenerator-runtime/runtime.js:62:40)
    at Generator.invoke [as _invoke] (/var/www/website/production/v2.0.0/node_modules/regenerator-runtime/runtime.js:296:22)
    at Generator.prototype.(anonymous function) [as throw] (/var/www/website/production/v2.0.0/node_modules/regenerator-runtime/runtime.js:114:21)
    at step (/var/www/website/production/v2.0.0/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
    at /var/www/website/production/v2.0.0/node_modules/babel-runtime/helpers/asyncToGenerator.js:30:13
    at <anonymous>

Renaming the production directory to something else solves it, or, even uglier, creating a devuction symlink pointing to production. Looking at the code there doesn't seem to be a way to disable that behavior.

Note that this is probably due to the importWorkboxFrom: 'local' option I'm using, so I suppose using the CDN would also resolve the issue, but I haven't tested that.

Any suggestions appreciated.

@jeffposnick
Copy link
Contributor

Thanks for pointing this out—the code that handles this translation is pretty brittle, unfortunately. I'll file a PR and add some tests to at least help with this scenario.

@freezy
Copy link
Author

freezy commented May 18, 2018

Thanks guys, you're awesome!

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

2 participants