Closed blixt closed 9 years ago
The way to install packages without modifications on npm is via jspm install npm:lameworker -o "{jspmNodeConversion: false}"
.
@guybedford Is it possible to apply that option only for that file? It is an NPM package and I do need the conversion to happen for the index.js
file. The package just also happens to distribute a standalone JavaScript file which must not be modified because it will be run outside of the main JavaScript environment (inside a Web Worker).
Essentially, I would like that one file to be considered nothing but a static file, similar to an image, and I'd prefer to not have to change its extension just to avoid this automatic conversion.
Unfortunately we don't have that option currently. At a practical level, you can think of that one file is effectively a separate "package" though?
I guess the worker script could be distributed it as a standalone, but that would be inconvenient to the people using the package. It would be similar to requiring someone to download a CSS file separately to be able to use a UI component. The worker file is integral to my package, it just doesn't live in the module system because it is a Web Worker.
The only practical solutions I can think of (besides preventing the file from being modified) is to either inline the worker (and load it as a Blob
instance), or change the extension to hide it from JSPM. Both are pretty hacky solutions, so if there could be an option to ignore specific .js files in JSPM that would be very useful.
It's a good point, but I'm hesitant to implement something here as this conversion layer will be changing to be configuration-based. That is, in future, there will be no actual rewriting of the underlying sources. So this problem should go away. Closing for now.
Hi there,
I've created this NPM package: https://www.npmjs.com/package/lameworker
It includes a file intended for a Web Worker,
lame.worker.js
, which is being rewritten by JSPM in a way that breaks the script (and adds almost 1 MB to its size). The script is written to be completely self-contained (because it's for a Web Worker), so it shouldn't be modified in any way. Is there a way to make JSPM ignore that file, but not theindex.js
NPM package?And a related question: Can I somehow generate the path to the
lame.worker.js
file? Right now, I need to specify the file to create the worker from like this:It would be great if I could somehow just specify
lameworker/dist/lame.worker.js
as the path and have the rest (especially the version) be resolved by SystemJS.