Fix the object to rollup-replace plugin (#8909)

The replacement should be in the argument object, instead of nested in `values` property
This commit is contained in:
Jeremy Meng 2020-05-14 10:06:28 -07:00 коммит произвёл GitHub
Родитель de7e78073f
Коммит c8ec3009f9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
26 изменённых файлов: 182 добавлений и 282 удалений

Просмотреть файл

@ -40,11 +40,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true }),
cjs()

Просмотреть файл

@ -24,11 +24,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true, mainFields: ["module"] }),
cjs()
@ -81,12 +79,10 @@ export function browserConfig(test = false) {
// ms-rest-js is externalized so users must include it prior to using this bundle.
{
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
),
nodeResolve({

Просмотреть файл

@ -50,11 +50,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true }),
cjs(),
@ -99,12 +97,10 @@ export function browserConfig(test = false) {
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}),
// dotenv doesn't work in the browser, so replace it with a no-op function

Просмотреть файл

@ -22,11 +22,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true }),
cjs()
@ -69,12 +67,10 @@ export function browserConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}),
nodeResolve({
mainFields: ["module", "browser"],

Просмотреть файл

@ -24,11 +24,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true }),
cjs()
@ -72,12 +70,10 @@ export function browserConfig(test = false, production = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}),
nodeResolve({
mainFields: ["module", "browser"],

Просмотреть файл

@ -24,11 +24,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true }),
cjs()
@ -71,12 +69,10 @@ export function browserConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}),
nodeResolve({
mainFields: ["module", "browser"],

Просмотреть файл

@ -44,11 +44,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true }),
cjs()
@ -97,12 +95,10 @@ export function browserConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}),
// os is not used by the browser bundle, so just shim it
shim({

Просмотреть файл

@ -22,11 +22,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true }),
cjs()
@ -69,12 +67,10 @@ export function browserConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}),
nodeResolve({
mainFields: ["module", "browser"],

Просмотреть файл

@ -26,11 +26,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true, mainFields: ["module"] }),
cjs()
@ -82,12 +80,10 @@ export function browserConfig(test = false) {
// ms-rest-js is externalized so users must include it prior to using this bundle.
{
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
),
nodeResolve({

Просмотреть файл

@ -29,11 +29,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true }),
cjs(),
@ -103,12 +101,10 @@ export function browserConfig(test = false) {
// ms-rest-js is externalized so users must include it prior to using this bundle.
{
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
),

Просмотреть файл

@ -27,11 +27,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true }),
cjs(),
@ -93,12 +91,10 @@ export function browserConfig(test = false) {
// ms-rest-js is externalized so users must include it prior to using this bundle.
{
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
),
nodeResolve({

Просмотреть файл

@ -30,11 +30,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true }),
cjs(),
@ -104,12 +102,10 @@ export function browserConfig(test = false) {
// ms-rest-js is externalized so users must include it prior to using this bundle.
{
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
),

Просмотреть файл

@ -25,11 +25,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true }),
cjs()
@ -74,12 +72,10 @@ export function browserConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}),
shim({
fs: `export default {}`,

Просмотреть файл

@ -22,11 +22,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true }),
cjs()
@ -70,12 +68,10 @@ export function browserConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}),
nodeResolve({
mainFields: ["module", "browser"],

Просмотреть файл

@ -46,11 +46,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true }),
cjs()
@ -104,12 +102,10 @@ export function browserConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}),
// os is not used by the browser bundle, so just shim it
shim({

Просмотреть файл

@ -46,11 +46,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true }),
cjs()
@ -102,12 +100,10 @@ export function browserConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}),
// os is not used by the browser bundle, so just shim it
shim({

Просмотреть файл

@ -46,11 +46,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true }),
cjs()
@ -102,12 +100,10 @@ export function browserConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}),
// os is not used by the browser bundle, so just shim it
shim({

Просмотреть файл

@ -25,11 +25,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true }),
cjs()
@ -74,12 +72,10 @@ export function browserConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}),
shim({
constants: `export default {}`,

Просмотреть файл

@ -54,12 +54,10 @@ export function nodeConfig({ test = false, production = false } = {}) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)",
"if (!isNode)": "if (false)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)",
"if (!isNode)": "if (false)"
}),
nodeResolve({ preferBuiltins: true }),
cjs(),
@ -114,13 +112,11 @@ export function browserConfig(test = false) {
// ms-rest-js is externalized so users must include it prior to using this bundle.
{
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)",
"if (!isNode)": "if (true)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)",
"if (!isNode)": "if (true)"
}
),
// fs, net, and tls are used by rhea and need to be shimmed

Просмотреть файл

@ -45,11 +45,10 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)",
"if (!isNode)": "if (false)"
}),
nodeResolve({ preferBuiltins: true }),
cjs()
@ -105,12 +104,11 @@ export function browserConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)",
"if (!isNode)": "if (true)"
}),
// fs and os are not used by the browser bundle, so just shim it
// dotenv doesn't work in the browser, so replace it with a no-op function

Просмотреть файл

@ -45,11 +45,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true }),
cjs({
@ -120,12 +118,10 @@ export function browserConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}),
// fs and os are not used by the browser bundle, so just shim it
// dotenv doesn't work in the browser, so replace it with a no-op function

Просмотреть файл

@ -45,11 +45,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true }),
cjs()
@ -105,12 +103,10 @@ export function browserConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}),
// fs and os are not used by the browser bundle, so just shim it
// dotenv doesn't work in the browser, so replace it with a no-op function

Просмотреть файл

@ -37,11 +37,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true }),
cjs()
@ -97,12 +95,10 @@ export function browserConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}),
// os is not used by the browser bundle, so just shim it
shim({

Просмотреть файл

@ -22,11 +22,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true }),
cjs()
@ -70,12 +68,10 @@ export function browserConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}),
nodeResolve({
mainFields: ["module", "browser"],

Просмотреть файл

@ -22,11 +22,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true }),
cjs()
@ -67,12 +65,10 @@ export function browserConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}),
nodeResolve({
mainFields: ["module", "browser"],

Просмотреть файл

@ -25,11 +25,9 @@ export function nodeConfig(test = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}
// replace dynamic checks with if (true) since this is for node only.
// Allows rollup's dead code elimination to be more aggressive.
"if (isNode)": "if (true)"
}),
nodeResolve({ preferBuiltins: true }),
cjs()
@ -74,12 +72,10 @@ export function browserConfig(test = false, production = false) {
sourcemaps(),
replace({
delimiters: ["", ""],
values: {
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)"
}),
shim({
constants: `export default {}`,