forked from openinula/inula
build: add esm format
This commit is contained in:
parent
95f658a6e5
commit
b4bbd146e8
|
@ -5,3 +5,6 @@ package-lock.json
|
|||
pnpm-lock.yaml
|
||||
/packages/**/node_modules
|
||||
/packages/inula-cli/lib
|
||||
build
|
||||
/packages/inula-router/connectRouter
|
||||
/packages/inula-router/router
|
||||
|
|
|
@ -18,14 +18,7 @@ module.exports = {
|
|||
presets: [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
targets: {
|
||||
browsers: ['> 1%', 'last 2 versions', 'not ie <= 8'],
|
||||
node: 'current',
|
||||
},
|
||||
useBuiltIns: 'usage',
|
||||
corejs: 3,
|
||||
},
|
||||
{ targets: { node: 'current' } },
|
||||
],
|
||||
[
|
||||
'@babel/preset-typescript',
|
||||
|
|
|
@ -38,6 +38,10 @@ export default {
|
|||
name: 'InulaI18n',
|
||||
format: 'umd',
|
||||
},
|
||||
{
|
||||
file: path.resolve(output, 'intl.esm-browser.js'),
|
||||
format: 'esm',
|
||||
}
|
||||
],
|
||||
plugins: [
|
||||
nodeResolve({
|
||||
|
|
|
@ -17,14 +17,7 @@ module.exports = {
|
|||
presets: [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
targets: {
|
||||
'browsers' : ['> 1%', 'last 2 versions', 'not ie <= 8'],
|
||||
'node': 'current'
|
||||
},
|
||||
useBuiltIns: 'usage',
|
||||
corejs: 3,
|
||||
}
|
||||
{ targets: { node: 'current' }},
|
||||
],
|
||||
[
|
||||
'@babel/preset-typescript',
|
||||
|
|
|
@ -21,13 +21,16 @@ import { babel } from '@rollup/plugin-babel';
|
|||
|
||||
export default {
|
||||
input: './index.ts',
|
||||
output: {
|
||||
output: [{
|
||||
file: 'dist/inulaRequest.js',
|
||||
format: 'umd',
|
||||
exports: 'named',
|
||||
name: 'inulaRequest',
|
||||
sourcemap: false,
|
||||
},
|
||||
}, {
|
||||
file: 'dist/inulaRequest.esm-browser.js',
|
||||
format: 'esm',
|
||||
}],
|
||||
plugins: [
|
||||
resolve(),
|
||||
commonjs(),
|
||||
|
@ -41,4 +44,7 @@ export default {
|
|||
presets: ['@babel/preset-env']
|
||||
})
|
||||
],
|
||||
external:[
|
||||
'openinula'
|
||||
]
|
||||
};
|
||||
|
|
|
@ -86,6 +86,11 @@ function genConfig(mode) {
|
|||
name: 'Inula',
|
||||
format: 'umd',
|
||||
},
|
||||
{
|
||||
file: outputResolve('esm', getOutputName(mode)),
|
||||
sourcemap,
|
||||
format: 'esm',
|
||||
},
|
||||
],
|
||||
plugins: [
|
||||
...getBasicPlugins(mode),
|
||||
|
@ -104,10 +109,13 @@ function genConfig(mode) {
|
|||
function genJSXRuntimeConfig(mode) {
|
||||
return {
|
||||
input: path.resolve(libDir, 'src', 'jsx-runtime.ts'),
|
||||
output: {
|
||||
output: [{
|
||||
file: outputResolve('jsx-runtime.js'),
|
||||
format: 'cjs',
|
||||
},
|
||||
}, {
|
||||
file: outputResolve('jsx-runtime.esm-browser.js'),
|
||||
format: 'esm',
|
||||
}],
|
||||
plugins: [...getBasicPlugins(mode)],
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue