Skip to content

Commit

Permalink
fix: pass process.env.NODE_ENV=production to rollup build config
Browse files Browse the repository at this point in the history
  • Loading branch information
limonte committed Jun 28, 2022
1 parent 7a1ff4c commit 734daa4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^21.0.3",
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-replace": "^4.0.0",
"@sweetalert2/eslint-config": "^1.1.3",
"@sweetalert2/prettier-config": "^1.0.0",
"@types/react": "^18.0.14",
Expand Down
7 changes: 6 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { nodeResolve } from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import replace from '@rollup/plugin-replace'
import { babel } from '@rollup/plugin-babel'
import { terser } from 'rollup-plugin-terser'
import pkg from './package.json'
Expand All @@ -14,6 +15,10 @@ const getBanner = (file) => `\

export default [false, true].map((minify) => {
const plugins = [
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
'preventAssignment': true,
}),
nodeResolve(),
commonjs(),
babel({
Expand Down Expand Up @@ -45,7 +50,7 @@ export default [false, true].map((minify) => {
format: 'umd',
name: 'sweetalert2ReactContent',
globals: {
react: 'React',
'react': 'React',
'react-dom': 'ReactDOM',
},
},
Expand Down
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1357,6 +1357,14 @@
is-module "^1.0.0"
resolve "^1.19.0"

"@rollup/plugin-replace@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@rollup/plugin-replace/-/plugin-replace-4.0.0.tgz#e34c457d6a285f0213359740b43f39d969b38a67"
integrity sha512-+rumQFiaNac9y64OHtkHGmdjm7us9bo1PlbgQfdihQtuNxzjpaB064HbRnewUOggLQxVCCyINfStkgmBeQpv1g==
dependencies:
"@rollup/pluginutils" "^3.1.0"
magic-string "^0.25.7"

"@rollup/pluginutils@^3.1.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b"
Expand Down

0 comments on commit 734daa4

Please sign in to comment.