mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
test rollup-plugin-dts
This commit is contained in:
parent
3131469fc2
commit
6a0e20d297
@ -3,6 +3,7 @@
|
|||||||
"version": "0.2.3",
|
"version": "0.2.3",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
"types": "tsc",
|
||||||
"build": "vue-tsc --noEmit && vite build",
|
"build": "vue-tsc --noEmit && vite build",
|
||||||
"rollup": "rollup -c"
|
"rollup": "rollup -c"
|
||||||
},
|
},
|
||||||
@ -25,6 +26,7 @@
|
|||||||
"eslint-plugin-standard": "^4.0.1",
|
"eslint-plugin-standard": "^4.0.1",
|
||||||
"eslint-plugin-vue": "^7.9.0",
|
"eslint-plugin-vue": "^7.9.0",
|
||||||
"gsap": "^3.5.1",
|
"gsap": "^3.5.1",
|
||||||
|
"rollup-plugin-dts": "^3.0.1",
|
||||||
"rollup-plugin-esbuild": "^4.1.0",
|
"rollup-plugin-esbuild": "^4.1.0",
|
||||||
"stats.js": "0.17.0",
|
"stats.js": "0.17.0",
|
||||||
"three": "^0.127",
|
"three": "^0.127",
|
||||||
@ -37,7 +39,7 @@
|
|||||||
},
|
},
|
||||||
"main": "build/trois.js",
|
"main": "build/trois.js",
|
||||||
"module": "build/trois.module.js",
|
"module": "build/trois.module.js",
|
||||||
"typings": "build/trois.d.ts",
|
"types": "build/trois.d.ts",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/troisjs/trois.git"
|
"url": "git+https://github.com/troisjs/trois.git"
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// import vue from 'rollup-plugin-vue'
|
// import vue from 'rollup-plugin-vue'
|
||||||
import esbuild from 'rollup-plugin-esbuild'
|
// import esbuild from 'rollup-plugin-esbuild'
|
||||||
import replace from '@rollup/plugin-replace'
|
// import replace from '@rollup/plugin-replace'
|
||||||
|
import dts from "rollup-plugin-dts"
|
||||||
|
// import { nodeResolve } from '@rollup/plugin-node-resolve'
|
||||||
|
|
||||||
const input = 'src/export.ts'
|
const input = 'src/export.ts'
|
||||||
|
|
||||||
@ -28,41 +30,50 @@ const external = [
|
|||||||
'vue',
|
'vue',
|
||||||
]
|
]
|
||||||
|
|
||||||
const cdnReplaces = {
|
// const cdnReplaces = {
|
||||||
'from \'vue\'': 'from \'https://unpkg.com/vue@3.0.11/dist/vue.esm-browser.prod.js\'',
|
// 'from \'vue\'': 'from \'https://unpkg.com/vue@3.0.11/dist/vue.esm-browser.prod.js\'',
|
||||||
'from \'three\'': 'from \'https://unpkg.com/three@0.127.0/build/three.module.js\'',
|
// 'from \'three\'': 'from \'https://unpkg.com/three@0.127.0/build/three.module.js\'',
|
||||||
'from \'three/examples': 'from \'https://unpkg.com/three@0.127.0/examples',
|
// 'from \'three/examples': 'from \'https://unpkg.com/three@0.127.0/examples',
|
||||||
delimiters: ['', ''],
|
// delimiters: ['', ''],
|
||||||
}
|
// }
|
||||||
|
|
||||||
function createConfig(format, output, plugins = [], minify = false) {
|
// function createConfig(format, output, plugins = [], minify = false) {
|
||||||
const tsPlugin = esbuild({
|
// const tsPlugin = esbuild({
|
||||||
sourceMap: true,
|
// sourceMap: true,
|
||||||
minify,
|
// minify,
|
||||||
target: 'es2019',
|
// target: 'es2019',
|
||||||
})
|
// })
|
||||||
|
|
||||||
return {
|
// return {
|
||||||
input,
|
// input,
|
||||||
external,
|
// external,
|
||||||
output: {
|
// output: {
|
||||||
format,
|
// format,
|
||||||
...output,
|
// ...output,
|
||||||
// exports: 'named',
|
// // exports: 'named',
|
||||||
sourcemap: true,
|
// sourcemap: true,
|
||||||
},
|
// },
|
||||||
plugins: [
|
// plugins: [
|
||||||
// vue(),
|
// // vue(),
|
||||||
tsPlugin,
|
// tsPlugin,
|
||||||
...plugins,
|
// ...plugins,
|
||||||
],
|
// ],
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
createConfig('es', { file: 'build/trois.module.cdn.js' }, [replace(cdnReplaces)]),
|
// createConfig('es', { file: 'build/trois.module.cdn.js' }, [replace(cdnReplaces)]),
|
||||||
createConfig('es', { file: 'build/trois.module.cdn.min.js' }, [replace(cdnReplaces)], true),
|
// createConfig('es', { file: 'build/trois.module.cdn.min.js' }, [replace(cdnReplaces)], true),
|
||||||
createConfig('es', { file: 'build/trois.module.js' }),
|
// createConfig('es', { file: 'build/trois.module.js' }),
|
||||||
createConfig('es', { file: 'build/trois.module.min.js' }, [], true),
|
// createConfig('es', { file: 'build/trois.module.min.js' }, [], true),
|
||||||
createConfig('cjs', { file: 'build/trois.js' }),
|
// createConfig('cjs', { file: 'build/trois.js' }),
|
||||||
|
{
|
||||||
|
input: 'types/export.d.ts',
|
||||||
|
external,
|
||||||
|
output: {
|
||||||
|
format: 'es',
|
||||||
|
file: 'build/trois.d.ts',
|
||||||
|
plugins: [dts()],
|
||||||
|
},
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
"outDir": "types",
|
"outDir": "types",
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts", "src/**/*.vue"],
|
"include": ["src/**/*.ts", "src/**/*.vue"],
|
||||||
|
"exclude": ["src/components/**/*.ts"],
|
||||||
// "include": ["src/export.ts"],
|
// "include": ["src/export.ts"],
|
||||||
// "exclude": ["src/App.vue", "src/main.ts"],
|
// "exclude": ["src/App.vue", "src/main.ts"],
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user