Skip to content

Commit

Permalink
Update rollup config for no IE11
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldenning committed Apr 16, 2024
1 parent 4fadf5a commit 971ab98
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 69 deletions.
20 changes: 4 additions & 16 deletions .babelrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
"@babel/preset-env",
{
"modules": false,
"bugfixes": true
"bugfixes": true,
"targets": {
"esmodules": true
}
}
],
"@babel/preset-typescript"
Expand All @@ -24,21 +27,6 @@
"@babel/preset-typescript"
],
"plugins": ["dynamic-import-node"]
},
"esm": {
"presets": [
[
"@babel/preset-env",
{
"modules": false,
"bugfixes": true,
"targets": {
"esmodules": true
}
}
],
"@babel/preset-typescript"
]
}
}
}
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@
"exports": {
".": {
"development": {
"import": "./lib/es2015/esm/single-spa.dev.js",
"require": "./lib/es2015/umd/single-spa.dev.cjs",
"import": "./lib/esm/single-spa.dev.js",
"require": "./lib/umd/single-spa.dev.cjs",
"types": "./typings/single-spa.d.ts"
},
"production": {
"import": "./lib/es2015/esm/single-spa.min.js",
"require": "./lib/es2015/umd/single-spa.min.cjs",
"import": "./lib/esm/single-spa.min.js",
"require": "./lib/umd/single-spa.min.cjs",
"types": "./typings/single-spa.d.ts"
},
"default": {
"import": "./lib/es2015/esm/single-spa.min.js",
"require": "./lib/es2015/umd/single-spa.min.cjs",
"import": "./lib/esm/single-spa.min.js",
"require": "./lib/umd/single-spa.min.cjs",
"types": "./typings/single-spa.d.ts"
}
},
"./package.json": "./package.json",
"./lib/*": "./lib/*"
},
"module": "lib/es2015/esm/single-spa.min.js",
"module": "lib/esm/single-spa.min.js",
"scripts": {
"build": "pnpm run clean && concurrently pnpm:build:dev pnpm:build:prod pnpm:build:types",
"build:prod": "rollup -c --environment ROLLUP_ENV:'production'",
Expand Down Expand Up @@ -116,7 +116,7 @@
"typescript": "^5.3.3"
},
"browserslist": [
">1%",
">5%",
"not ie <= 11"
],
"ignore": [
Expand Down
53 changes: 8 additions & 45 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import analyzer from "rollup-plugin-analyzer";
import replace from "@rollup/plugin-replace";
import packageJson from "./package.json";

const isProduction = process.env.NODE_ENV === "production";
const isProduction = process.env.ROLLUP_ENV === "production";
const useAnalyzer = process.env.ANALYZER === "analyzer";

const replaceOpts = {
Expand Down Expand Up @@ -41,60 +41,23 @@ export default (async () => [
input: `./src/single-spa${isProduction ? "" : ".profile"}.ts`,
output: [
{
file: `./lib/es5/umd/single-spa${isProduction ? ".min" : ".dev"}.cjs`,
file: `./lib/umd/single-spa${isProduction ? ".min" : ".dev"}.cjs`,
format: "umd",
name: "singleSpa",
sourcemap: true,
banner: generateBanner("UMD ES5"),
banner: generateBanner("UMD"),
},
{
file: `./lib/es5/system/single-spa${isProduction ? ".min" : ".dev"}.js`,
format: "system",
sourcemap: true,
banner: generateBanner("SystemJS ES5"),
},
{
file: `./lib/es5/esm/single-spa${isProduction ? ".min" : ".dev"}.js`,
format: "esm",
sourcemap: true,
banner: generateBanner("ESM ES5"),
},
],
plugins: [
replace(replaceOpts),
resolve(resolveOpts),
babel(babelOpts),
commonjs(),
isProduction &&
(await import("@rollup/plugin-terser")).terser(terserOpts),
useAnalyzer && analyzer(),
],
},
{
input: `./src/single-spa${isProduction ? "" : ".profile"}.ts`,
output: [
{
file: `./lib/es2015/umd/single-spa${
isProduction ? ".min" : ".dev"
}.cjs`,
format: "umd",
name: "singleSpa",
sourcemap: true,
banner: generateBanner("UMD ES2015"),
},
{
file: `./lib/es2015/esm/single-spa${isProduction ? ".min" : ".dev"}.js`,
file: `./lib/esm/single-spa${isProduction ? ".min" : ".dev"}.js`,
format: "esm",
sourcemap: true,
banner: generateBanner("ES2015"),
banner: generateBanner("ESM"),
},
{
file: `./lib/es2015/system/single-spa${
isProduction ? ".min" : ".dev"
}.js`,
file: `./lib/system/single-spa${isProduction ? ".min" : ".dev"}.js`,
format: "system",
sourcemap: true,
banner: generateBanner("SystemJS ES2015"),
banner: generateBanner("SystemJS"),
},
],
plugins: [
Expand All @@ -107,7 +70,7 @@ export default (async () => [
),
commonjs(),
isProduction &&
(await import("@rollup/plugin-terser")).terser(
(await import("@rollup/plugin-terser")).default(
Object.assign({}, terserOpts, {
ecma: 6,
module: true,
Expand Down

0 comments on commit 971ab98

Please sign in to comment.