Skip to content

Commit 6a1eace

Browse files
Add production NODE_ENV for build script only
1 parent 226f4c2 commit 6a1eace

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

.storybook/main.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ const config: StorybookConfig = {
1616

1717
viteFinal(config) {
1818
return mergeConfig(config, {
19-
plugins: [tsConfigPaths()],
19+
plugins: [
20+
tsConfigPaths({
21+
projects: ['./tsconfig.dev.json'],
22+
}),
23+
],
2024
css: {
2125
preprocessorOptions: {
2226
scss: {

babel.config.cjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
const { NODE_ENV } = process.env;
1+
// Node.js environment with default
2+
// https://nodejs.org/en/learn/getting-started/nodejs-the-difference-between-development-and-production
3+
const { NODE_ENV = 'development' } = process.env;
24

35
/**
46
* Babel config
@@ -25,7 +27,7 @@ module.exports = {
2527
[
2628
'@babel/preset-react',
2729
{
28-
development: NODE_ENV === 'development',
30+
development: NODE_ENV === 'test' || NODE_ENV === 'development',
2931
runtime: 'automatic',
3032
useBuiltIns: true,
3133
},

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
],
5353
"scripts": {
5454
"cleanup": "rm -rf dist/ > /dev/null",
55-
"build": "yarn cleanup && rollup -c",
56-
"storybook": "NODE_ENV=development storybook dev -p 6006",
55+
"build": "NODE_ENV=production yarn cleanup && rollup -c",
56+
"storybook": "storybook dev -p 6006",
5757
"build-storybook": "storybook build",
5858
"test": "jest",
5959
"test:watch": "jest --watch",

0 commit comments

Comments
 (0)