badcafe / rollup-plugin-inject-process-env

Inject environment variables in process.env with Rollup
MIT License
51 stars 5 forks source link

This plugins adds code which later prevents minification if imported from CRA #13

Open alvaro-cuesta opened 3 years ago

alvaro-cuesta commented 3 years ago

I'm using this plugin to inject process.env in a Svelte Web Component, which is later imported on a Create React App project.

When building on Create React App we get this error:

Failed to minify the code from this file: 

        ../my-package/dist/my-package.0.1.0.js:8:8 

Which points to this line in the injected code:

process.env = Object.assign({}, process.env);

I'm not sure what's causing the minification error there but it looks like this plugin's output is not transpiled by @rollup/plugin-babel into ES5 (I'm guessing due to these lines).

Any way to fix this?