Skip to content

Commit

Permalink
fixed: replaced process.env conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
GianlucaGuarini committed Mar 29, 2024
1 parent 3893ff4 commit 5c624dd
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 0 deletions.
7 changes: 7 additions & 0 deletions build/rollup.browser.config.js
@@ -1,4 +1,5 @@
import alias from '@rollup/plugin-alias'
import replace from '@rollup/plugin-replace'
import builtins from 'rollup-plugin-node-builtins'
import commonjs from '@rollup/plugin-commonjs'
import defaultConfig from './rollup.config.js'
Expand Down Expand Up @@ -28,6 +29,12 @@ export default {
},
external: ignoredModules,
plugins: [
replace({
preventAssignment: true,
values: {
'process.env.NODE_ENV': JSON.stringify('production'),
},
}),
builtins(),
json(),
alias({
Expand Down
7 changes: 7 additions & 0 deletions build/rollup.essential.config.js
Expand Up @@ -2,6 +2,7 @@ import alias from '@rollup/plugin-alias'
import commonjs from '@rollup/plugin-commonjs'
import defaultConfig from './rollup.config.js'
import json from '@rollup/plugin-json'
import replace from '@rollup/plugin-replace'
import nodeResolve from '@rollup/plugin-node-resolve'
import { visualizer } from 'rollup-plugin-visualizer'
import path from 'node:path'
Expand Down Expand Up @@ -41,6 +42,12 @@ export default ['umd', 'esm'].map((format) => ({
external: ignoredModules.concat(format === 'esm' ? [/@riotjs\/(util)/] : []),
plugins: [
ignore(),
replace({
preventAssignment: true,
values: {
'process.env.NODE_ENV': JSON.stringify('production'),
},
}),
json({
namedExports: true,
preferConst: true,
Expand Down
7 changes: 7 additions & 0 deletions build/rollup.node.config.js
@@ -1,11 +1,18 @@
import commonjs from '@rollup/plugin-commonjs'
import replace from '@rollup/plugin-replace'
import defaultConfig from './rollup.config.js'
import json from '@rollup/plugin-json'
import nodeResolve from '@rollup/plugin-node-resolve'

export default {
...defaultConfig,
plugins: [
replace({
preventAssignment: true,
values: {
'process.env.NODE_ENV': JSON.stringify('production'),
},
}),
// bundle only the json files
json(),
nodeResolve({
Expand Down
32 changes: 32 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -58,6 +58,7 @@
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.5",
"acorn": "^8.11.3",
"c8": "^9.1.0",
"chai": "^5.1.0",
Expand Down

0 comments on commit 5c624dd

Please sign in to comment.