Skip to content

Commit

Permalink
fix(component): vite build issue with process.env.NODE_ENV
Browse files Browse the repository at this point in the history
  • Loading branch information
rhahao authored Jul 6, 2022
1 parent 93391f8 commit b316b44
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 24 deletions.
36 changes: 13 additions & 23 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,60 @@
# [1.0.0-beta.2](https://github.com/sws2apps/react-sw-helper/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2022-07-06)


### Features

* **component:** use vite to build component ([c4fe758](https://github.com/sws2apps/react-sw-helper/commit/c4fe7581fc512e5307f169379373dfbe2bcbaea9))
- **component:** use vite to build component ([c4fe758](https://github.com/sws2apps/react-sw-helper/commit/c4fe7581fc512e5307f169379373dfbe2bcbaea9))

## [1.2.1](https://github.com/sws2apps/react-sw-helper/compare/v1.2.0...v1.2.1) (2022-07-05)


### Bug Fixes

* **component:** minor update to package dependencies ([d35ac89](https://github.com/sws2apps/react-sw-helper/commit/d35ac893ac3208a7346252882bc3a9d1a2a63bff))
- **component:** minor update to package dependencies ([d35ac89](https://github.com/sws2apps/react-sw-helper/commit/d35ac893ac3208a7346252882bc3a9d1a2a63bff))

# [1.2.0](https://github.com/sws2apps/react-sw-helper/compare/v1.1.0...v1.2.0) (2022-06-28)


### Features

* **component:** update peersDependencies and add peerDependenciesMeta ([c1ed77b](https://github.com/sws2apps/react-sw-helper/commit/c1ed77b9ec5eb2c3b8125e40fd6a28ebd07e6293))
- **component:** update peersDependencies and add peerDependenciesMeta ([c1ed77b](https://github.com/sws2apps/react-sw-helper/commit/c1ed77b9ec5eb2c3b8125e40fd6a28ebd07e6293))

# [1.1.0](https://github.com/sws2apps/react-sw-helper/compare/v1.0.0...v1.1.0) (2022-06-10)


### Features

* **deps:** bump npm from 8.10.0 to 8.12.0 ([85932a8](https://github.com/sws2apps/react-sw-helper/commit/85932a81244d2c597874f466c8960c1b01d3546d))
* **deps:** bump semantic-release from 19.0.2 to 19.0.3 ([e5dee27](https://github.com/sws2apps/react-sw-helper/commit/e5dee2702a31e9bb4c2f8641cbc5b5b743425931))
- **deps:** bump npm from 8.10.0 to 8.12.0 ([85932a8](https://github.com/sws2apps/react-sw-helper/commit/85932a81244d2c597874f466c8960c1b01d3546d))
- **deps:** bump semantic-release from 19.0.2 to 19.0.3 ([e5dee27](https://github.com/sws2apps/react-sw-helper/commit/e5dee2702a31e9bb4c2f8641cbc5b5b743425931))

# 1.0.0 (2022-05-22)


### Features

* **component:** initial release ([f4454fd](https://github.com/sws2apps/react-sw-helper/commit/f4454fd503663d317c2cf851443442d6f3efabeb))
- **component:** initial release ([f4454fd](https://github.com/sws2apps/react-sw-helper/commit/f4454fd503663d317c2cf851443442d6f3efabeb))

# 1.0.0-beta.1 (2022-05-20)


### Bug Fixes

* **package.json:** add missing fields ([e4f5c93](https://github.com/sws2apps/react-sw-helper/commit/e4f5c9358a29cfb9a100546b6e75f829f1eb86a3))
* **package.json:** add publishConfig ([4c082ee](https://github.com/sws2apps/react-sw-helper/commit/4c082ee5f684b8f92171a9cb4e013e9a40548479))

- **package.json:** add missing fields ([e4f5c93](https://github.com/sws2apps/react-sw-helper/commit/e4f5c9358a29cfb9a100546b6e75f829f1eb86a3))
- **package.json:** add publishConfig ([4c082ee](https://github.com/sws2apps/react-sw-helper/commit/4c082ee5f684b8f92171a9cb4e013e9a40548479))

### Features

* **module:** initial commit ([d670d25](https://github.com/sws2apps/react-sw-helper/commit/d670d25a34cf4e6d3a1c7b23f6e7d200b1124c42))
* **module:** move alpha to beta release ([9a7fb6e](https://github.com/sws2apps/react-sw-helper/commit/9a7fb6e4cee25e05738b9ff962d1d5ced8fb7c12))
- **module:** initial commit ([d670d25](https://github.com/sws2apps/react-sw-helper/commit/d670d25a34cf4e6d3a1c7b23f6e7d200b1124c42))
- **module:** move alpha to beta release ([9a7fb6e](https://github.com/sws2apps/react-sw-helper/commit/9a7fb6e4cee25e05738b9ff962d1d5ced8fb7c12))

# [1.0.0-alpha.3](https://github.com/sws2apps/react-sw-helper/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2022-05-18)


### Bug Fixes

* **package.json:** add publishConfig ([4c082ee](https://github.com/sws2apps/react-sw-helper/commit/4c082ee5f684b8f92171a9cb4e013e9a40548479))
- **package.json:** add publishConfig ([4c082ee](https://github.com/sws2apps/react-sw-helper/commit/4c082ee5f684b8f92171a9cb4e013e9a40548479))

# [1.0.0-alpha.2](https://github.com/sws2apps/react-sw-helper/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2022-05-18)


### Bug Fixes

* **package.json:** add missing fields ([e4f5c93](https://github.com/sws2apps/react-sw-helper/commit/e4f5c9358a29cfb9a100546b6e75f829f1eb86a3))
- **package.json:** add missing fields ([e4f5c93](https://github.com/sws2apps/react-sw-helper/commit/e4f5c9358a29cfb9a100546b6e75f829f1eb86a3))

# 1.0.0-alpha.1 (2022-05-18)


### Features

* **module:** initial commit ([d670d25](https://github.com/sws2apps/react-sw-helper/commit/d670d25a34cf4e6d3a1c7b23f6e7d200b1124c42))
- **module:** initial commit ([d670d25](https://github.com/sws2apps/react-sw-helper/commit/d670d25a34cf4e6d3a1c7b23f6e7d200b1124c42))
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@sws2apps/react-sw-helper",
"description": "A pure react component library to handle service worker",
"version": "1.0.0-beta.2",
"type":"module",
"license": "MIT",
"keywords": [
"react",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const ServiceWorkerWrapper = ({
}, [registration]);

useEffect(() => {
if (process.env.NODE_ENV === 'production') {
if (process.env['NODE_ENV'] === 'production') {
register();
}
}, [register]);
Expand Down
3 changes: 3 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

export default defineConfig({
define: {
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
},
build: {
lib: {
entry: path.resolve(__dirname, 'src/lib/index.jsx'),
Expand Down

0 comments on commit b316b44

Please sign in to comment.