feat: add umd bundle (#457)

This commit is contained in:
hangzou
2021-06-24 20:20:08 +08:00
committed by GitHub
parent 1ac52f8bdd
commit b0cdddae94
4 changed files with 81 additions and 3 deletions

View File

@ -5,6 +5,14 @@ module.exports = {
],
plugins: [
/* eslint-disable-next-line global-require */
[require('./dist/index.js'), { optimize: true, isCustomElement: (tag) => /^x-/.test(tag) }],
[
!process.env.MODE
? require('./dist/index.js')
: require('./dist/vue-jsx.min.js'),
{
optimize: true,
isCustomElement: (tag) => /^x-/.test(tag)
},
],
],
};

View File

@ -6,14 +6,15 @@
"homepage": "https://github.com/vuejs/jsx-next/tree/dev/packages/babel-plugin-jsx#readme",
"license": "MIT",
"main": "dist/index.js",
"unpkg": "dist/vue-jsx.min.js",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/jsx-next.git"
},
"scripts": {
"build": "tsc",
"build": "rm -rf dist && tsc && rollup -c rollup.config.js",
"lint": "eslint 'src/*.ts'",
"test": "yarn build && jest --coverage",
"test": "yarn build && jest --coverage && jest --clearCache && MODE=umd jest --coverage",
"prepublishOnly": "yarn build"
},
"bugs": {
@ -42,8 +43,11 @@
"@typescript-eslint/parser": "^4.0.1",
"@vue/compiler-dom": "3.0.5",
"@vue/test-utils": "2.0.0-beta.2",
"esbuild": "^0.12.9",
"jest": "^26.0.1",
"regenerator-runtime": "^0.13.5",
"rollup": "^2.52.2",
"rollup-plugin-esbuild": "^4.5.0",
"ts-jest": "^26.1.3",
"typescript": "^4.2.3",
"vue": "3.0.7"

View File

@ -0,0 +1,17 @@
import esbuild from 'rollup-plugin-esbuild'
export default {
input: 'src/index.ts',
output: [
{
file: `dist/vue-jsx.min.js`,
format: 'umd',
name: `vue-jsx`,
},
],
plugins: [
esbuild({
minify: true,
}),
],
}