Match-id-5bad0bb66ce628a366c9f96c499b0f7c84ec9b8e
This commit is contained in:
parent
15c1e906a3
commit
71db7f0f6b
|
@ -16,9 +16,10 @@
|
||||||
import {
|
import {
|
||||||
TYPE_FRAGMENT as Fragment,
|
TYPE_FRAGMENT as Fragment,
|
||||||
} from './src/external/JSXElementType';
|
} from './src/external/JSXElementType';
|
||||||
import { jsx } from './src/external/JSXElement';
|
import { jsx, jsx as jsxs } from './src/external/JSXElement';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
jsx,
|
jsx,
|
||||||
|
jsxs,
|
||||||
Fragment
|
Fragment
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,7 +37,13 @@ if (!fs.existsSync(outDir)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const outputResolve = (...p) => path.resolve(outDir, ...p);
|
const outputResolve = (...p) => path.resolve(outDir, ...p);
|
||||||
const BasicPlugins = [
|
|
||||||
|
const isDev = (mode) => {
|
||||||
|
return mode === 'development';
|
||||||
|
}
|
||||||
|
|
||||||
|
const getBasicPlugins = (mode) => {
|
||||||
|
return [
|
||||||
nodeResolve({
|
nodeResolve({
|
||||||
extensions,
|
extensions,
|
||||||
modulesOnly: true,
|
modulesOnly: true,
|
||||||
|
@ -47,16 +53,26 @@ const BasicPlugins = [
|
||||||
configFile: path.join(__dirname, '../../babel.config.js'),
|
configFile: path.join(__dirname, '../../babel.config.js'),
|
||||||
babelHelpers: 'runtime',
|
babelHelpers: 'runtime',
|
||||||
extensions,
|
extensions,
|
||||||
})
|
}),
|
||||||
];
|
replace({
|
||||||
|
values: {
|
||||||
|
'process.env.NODE_ENV': `"${mode}"`,
|
||||||
|
isDev: isDev(mode).toString(),
|
||||||
|
isTest: false,
|
||||||
|
__VERSION__: `"${horizonVersion}"`,
|
||||||
|
},
|
||||||
|
preventAssignment: true,
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function getOutputName(mode) {
|
function getOutputName(mode) {
|
||||||
return mode === 'production' ? `horizon.${mode}.min.js` : `horizon.${mode}.js`;
|
return mode === 'production' ? `horizon.${mode}.min.js` : `horizon.${mode}.js`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function genConfig(mode) {
|
function genConfig(mode) {
|
||||||
const isDev = mode === 'development';
|
const sourcemap = isDev(mode) ? 'inline' : false;
|
||||||
const sourcemap = isDev ? 'inline' : false;
|
|
||||||
return {
|
return {
|
||||||
input: path.resolve(libDir, 'index.ts'),
|
input: path.resolve(libDir, 'index.ts'),
|
||||||
output: [
|
output: [
|
||||||
|
@ -73,16 +89,7 @@ function genConfig(mode) {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
plugins: [
|
plugins: [
|
||||||
...BasicPlugins,
|
...getBasicPlugins(mode),
|
||||||
replace({
|
|
||||||
values: {
|
|
||||||
'process.env.NODE_ENV': `"${mode}"`,
|
|
||||||
isDev: isDev.toString(),
|
|
||||||
isTest: false,
|
|
||||||
__VERSION__: `"${horizonVersion}"`,
|
|
||||||
},
|
|
||||||
preventAssignment: true,
|
|
||||||
}),
|
|
||||||
execute('npm run build-types'),
|
execute('npm run build-types'),
|
||||||
mode === 'production' && terser(),
|
mode === 'production' && terser(),
|
||||||
copy([
|
copy([
|
||||||
|
@ -99,7 +106,7 @@ function genConfig(mode) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function genJSXRuntimeConfig() {
|
function genJSXRuntimeConfig(mode) {
|
||||||
return {
|
return {
|
||||||
input: path.resolve(libDir, 'jsx-runtime.ts'),
|
input: path.resolve(libDir, 'jsx-runtime.ts'),
|
||||||
output: [
|
output: [
|
||||||
|
@ -108,7 +115,9 @@ function genJSXRuntimeConfig() {
|
||||||
format: 'cjs',
|
format: 'cjs',
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
plugins: BasicPlugins
|
plugins: [
|
||||||
|
...getBasicPlugins(mode)
|
||||||
|
]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
export default [genConfig('development'), genConfig('production'), genJSXRuntimeConfig()];
|
export default [genConfig('development'), genConfig('production'), genJSXRuntimeConfig('')];
|
||||||
|
|
Loading…
Reference in New Issue