GoogleChromeLabs / worker-plugin

👩‍🏭 Adds native Web Worker bundling support to Webpack.
https://npm.im/worker-plugin
Apache License 2.0
1.91k stars 79 forks source link

Using environment variables #107

Closed josteph closed 3 years ago

josteph commented 3 years ago

During runtime, I'm getting process is not defined error, because some parts of the config files have process.env.* which should be replaced during the build time.

Is there anyway to replace process.env.* using worker-plugin?

I have tried this so far but it's still not working:

const Dotenv = require('dotenv-webpack');

new WorkerPlugin({
        plugins: [
          new Dotenv({
            path: './.env',
            systemvars: true,
          }),
        ],
})
josteph commented 3 years ago

Please nevermind this issue, I'm so silly 🤦‍♂️

If anybody stumbled upon this, you can check the solution here https://github.com/parcel-bundler/parcel/issues/1722#issuecomment-404845885