Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

Commit

Permalink
fix: add process support for undefined env variables (#668)
Browse files Browse the repository at this point in the history
  • Loading branch information
ClarkXia authored Nov 7, 2022
1 parent 98ff4a0 commit e8ad84c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions examples/basic-project/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ console.log('__LOG__');
console.warn('__WARN__');
console.error('__ERROR__');
console.log('process.env.HAHA', process.env.HAHA);
console.log('process.env.undefinedEnv', process.env.undefinedEnv);

if (isWeb) {
console.error('__IS_WEB__');
Expand Down
3 changes: 2 additions & 1 deletion packages/webpack-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"@ice/bundles": "^0.1.0",
"@rollup/pluginutils": "^4.2.0",
"consola": "^2.15.3",
"fast-glob": "^3.2.11"
"fast-glob": "^3.2.11",
"process": "^0.11.10"
},
"devDependencies": {
"esbuild": "^0.14.51",
Expand Down
3 changes: 3 additions & 0 deletions packages/webpack-config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ const getWebpackConfig: GetWebpackConfig = ({ rootDir, config, webpack, runtimeT
// use webpack-dev-server overlay instead
overlay: false,
}),
new webpack.ProvidePlugin({
process: require.resolve('process/browser'),
}),
new webpack.DefinePlugin({
...defineVars,
...runtimeDefineVars,
Expand Down
7 changes: 7 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit e8ad84c

@vercel
Copy link

@vercel vercel bot commented on e8ad84c Nov 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ice-v3 – ./

ice-v3-ice-v3.vercel.app
ice-v3.vercel.app
ice-v3-git-release-next-ice-v3.vercel.app

Please sign in to comment.