Skip to content

Commit

Permalink
Update rollup to add inject-process-env
Browse files Browse the repository at this point in the history
  • Loading branch information
rstacruz committed Sep 21, 2022
1 parent cc7bbbc commit 38c957a
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 448 deletions.
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@
"puppeteer": "^1.12.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rollup": "^1.1.2",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-babel-minify": "^7.0.0",
"rollup-plugin-commonjs": "^9.3.4",
"rollup": "^2.79.0",
"rollup-plugin-copy": "^0.2.3",
"rollup-plugin-node-resolve": "^4.2.3",
"rollup-plugin-server": "^0.7.0",
"start-server-and-test": "^1.7.11",
"tslint": "^5.12.1",
Expand Down Expand Up @@ -82,5 +78,11 @@
"prepare": "run-s build",
"test": "start-server-and-test watch http://127.0.0.1:10049/ jest",
"watch": "env NODE_ENV=test-rollup rollup --config --watch"
},
"dependencies": {
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^22.0.2",
"@rollup/plugin-node-resolve": "^14.1.0",
"rollup-plugin-inject-process-env": "^1.3.1"
}
}
17 changes: 8 additions & 9 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
// rollup.config.js
import babel from 'rollup-plugin-babel'
import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
import minify from 'rollup-plugin-babel-minify'
import babel from '@rollup/plugin-babel'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import injectProcessEnv from 'rollup-plugin-inject-process-env'
import server from 'rollup-plugin-server'
import copy from 'rollup-plugin-copy'

const IS_TEST = process.env.NODE_ENV === 'test-rollup'
const IS_WATCH = process.argv.includes('--watch')

const MINIFY = minify({ comments: false })
// const MINIFY = minify({ comments: false })

// Modern builds will not bundle dependencies
const PLUGINS = [resolve({ browser: true }), commonjs()]
const PLUGINS = [resolve({ browser: true }), commonjs(), injectProcessEnv({ NODE_ENV: process.env.NODE_ENV })]

const BABEL = babel({
exclude: 'node_modules/**'
Expand Down Expand Up @@ -65,7 +64,7 @@ export default [

{
...DEFAULTS,
plugins: [...PLUGINS, MINIFY],
plugins: [...PLUGINS],
output: { file: 'dist/remount.min.js', format: 'esm' }
},

Expand All @@ -80,7 +79,7 @@ export default [
{
...DEFAULTS,
external: ['react', 'react-dom'],
plugins: [...PLUGINS, BABEL, MINIFY],
plugins: [...PLUGINS, BABEL],
output: { file: 'dist/remount.es5.min.js', ...UMD }
},

Expand Down
Loading

0 comments on commit 38c957a

Please sign in to comment.