mirror of
https://github.com/pmndrs/zustand.git
synced 2025-12-08 19:45:52 +00:00
fix(build): no import.meta for "module" condition (#1393)
* fix(build): no import.meta for "module" condition * be consistent with others
This commit is contained in:
parent
296bb4bc96
commit
20ee6e9633
@ -52,10 +52,7 @@ function createDeclarationConfig(input, output) {
|
||||
function createESMConfig(input, output) {
|
||||
return {
|
||||
input,
|
||||
output: [
|
||||
{ file: `${output}.js`, format: 'esm' },
|
||||
{ file: `${output}.mjs`, format: 'esm' },
|
||||
],
|
||||
output: { file: output, format: 'esm' },
|
||||
external,
|
||||
plugins: [
|
||||
alias({
|
||||
@ -65,7 +62,9 @@ function createESMConfig(input, output) {
|
||||
}),
|
||||
resolve({ extensions }),
|
||||
replace({
|
||||
__DEV__: '(import.meta.env&&import.meta.env.MODE)!=="production"',
|
||||
__DEV__: output.endsWith('.mjs')
|
||||
? '((import.meta.env&&import.meta.env.MODE)!=="production")'
|
||||
: '(process.env.NODE_ENV!=="production")',
|
||||
// a workround for #829
|
||||
'use-sync-external-store/shim/with-selector':
|
||||
'use-sync-external-store/shim/with-selector.js',
|
||||
@ -89,7 +88,7 @@ function createCommonJSConfig(input, output) {
|
||||
}),
|
||||
resolve({ extensions }),
|
||||
replace({
|
||||
__DEV__: 'process.env.NODE_ENV!=="production"',
|
||||
__DEV__: '(process.env.NODE_ENV!=="production")',
|
||||
preventAssignment: true,
|
||||
}),
|
||||
babelPlugin(getBabelOptions({ ie: 11 })),
|
||||
@ -140,7 +139,6 @@ function createSystemConfig(input, output, env) {
|
||||
output: {
|
||||
file: `${output}.${env}.js`,
|
||||
format: 'system',
|
||||
exports: 'named',
|
||||
},
|
||||
external,
|
||||
plugins: [
|
||||
@ -169,7 +167,8 @@ module.exports = function (args) {
|
||||
return [
|
||||
...(c === 'index' ? [createDeclarationConfig(`src/${c}.ts`, 'dist')] : []),
|
||||
createCommonJSConfig(`src/${c}.ts`, `dist/${c}`),
|
||||
createESMConfig(`src/${c}.ts`, `dist/esm/${c}`),
|
||||
createESMConfig(`src/${c}.ts`, `dist/esm/${c}.js`),
|
||||
createESMConfig(`src/${c}.ts`, `dist/esm/${c}.mjs`),
|
||||
createUMDConfig(`src/${c}.ts`, `dist/umd/${c}`, 'development'),
|
||||
createUMDConfig(`src/${c}.ts`, `dist/umd/${c}`, 'production'),
|
||||
createSystemConfig(`src/${c}.ts`, `dist/system/${c}`, 'development'),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user