Skip to content

Commit b52bee9

Browse files
committed
fix(build): raw esm for dev only
Fix #1485
1 parent 1a39d4f commit b52bee9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

rollup.config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ function createConfig(buildName, output, plugins = []) {
136136
isProductionBuild,
137137
isBundlerESMBuild,
138138
// isBrowserBuild?
139-
isGlobalBuild || isRawESMBuild || isBundlerESMBuild,
139+
isRawESMBuild,
140140
isGlobalBuild,
141141
isNodeBuild
142142
),
@@ -155,26 +155,26 @@ function createConfig(buildName, output, plugins = []) {
155155
function createReplacePlugin(
156156
isProduction,
157157
isBundlerESMBuild,
158-
isBrowserBuild,
158+
isRawESMBuild,
159159
isGlobalBuild,
160160
isNodeBuild
161161
) {
162162
const replacements = {
163163
__COMMIT__: `"${process.env.COMMIT}"`,
164164
__VERSION__: `"${pkg.version}"`,
165165
__DEV__:
166-
isBundlerESMBuild || (isNodeBuild && !isProduction)
166+
(isBundlerESMBuild && !isRawESMBuild) || (isNodeBuild && !isProduction)
167167
? // preserve to be handled by bundlers
168168
`(process.env.NODE_ENV !== 'production')`
169169
: // hard coded dev/prod builds
170170
JSON.stringify(!isProduction),
171171
// this is only used during tests
172172
__TEST__:
173-
isBundlerESMBuild || isNodeBuild
173+
(isBundlerESMBuild && !isRawESMBuild) || isNodeBuild
174174
? `(process.env.NODE_ENV === 'test')`
175175
: 'false',
176176
// If the build is expected to run directly in the browser (global / esm builds)
177-
__BROWSER__: JSON.stringify(isBrowserBuild),
177+
__BROWSER__: JSON.stringify(isRawESMBuild),
178178
// is targeting bundlers?
179179
__BUNDLER__: JSON.stringify(isBundlerESMBuild),
180180
__GLOBAL__: JSON.stringify(isGlobalBuild),

0 commit comments

Comments
 (0)