feat(Poppperjs): add esm output

This commit is contained in:
chenjiahan 2020-12-04 13:31:42 +08:00
parent 1304c6f36b
commit 5f436fc62f
3 changed files with 16 additions and 6 deletions

View File

@ -2,8 +2,12 @@
"name": "@vant/popperjs", "name": "@vant/popperjs",
"version": "1.0.0", "version": "1.0.0",
"description": "Precompiled popperjs core", "description": "Precompiled popperjs core",
"main": "lib/index.js", "main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "lib/index.d.ts", "types": "lib/index.d.ts",
"files": [
"dist"
],
"publishConfig": { "publishConfig": {
"access": "public", "access": "public",
"registry": "https://registry.npmjs.org/" "registry": "https://registry.npmjs.org/"

View File

@ -4,9 +4,15 @@ import nodeResolve from '@rollup/plugin-node-resolve';
export default { export default {
input: path.join(__dirname, 'src', 'index.ts'), input: path.join(__dirname, 'src', 'index.ts'),
output: { output: [
dir: 'lib', {
format: 'cjs', dir: 'dist/cjs',
}, format: 'cjs',
},
{
dir: 'dist/esm',
format: 'esm',
},
],
plugins: [nodeResolve(), babel({ babelHelpers: 'runtime' })], plugins: [nodeResolve(), babel({ babelHelpers: 'runtime' })],
}; };

View File

@ -1,7 +1,7 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es5", "target": "es5",
"outDir": "./lib", "outDir": "./dist",
"module": "ES2015", "module": "ES2015",
"strict": true, "strict": true,
"declaration": true, "declaration": true,