mirror of
https://github.com/troisjs/trois.git
synced 2024-11-23 20:02:32 +08:00
rollup-plugin-esbuild
This commit is contained in:
parent
49a0c1fef2
commit
3131469fc2
@ -8,7 +8,6 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@microsoft/api-extractor": "^7.14.0",
|
"@microsoft/api-extractor": "^7.14.0",
|
||||||
"@rollup/plugin-buble": "^0.21.3",
|
|
||||||
"@rollup/plugin-replace": "^2.3.3",
|
"@rollup/plugin-replace": "^2.3.3",
|
||||||
"@types/three": "^0.127.1",
|
"@types/three": "^0.127.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.22.0",
|
"@typescript-eslint/eslint-plugin": "^4.22.0",
|
||||||
@ -18,6 +17,7 @@
|
|||||||
"@vue/eslint-config-standard": "^5.1.2",
|
"@vue/eslint-config-standard": "^5.1.2",
|
||||||
"@vue/eslint-config-typescript": "^7.0.0",
|
"@vue/eslint-config-typescript": "^7.0.0",
|
||||||
"cannon": "^0.6.2",
|
"cannon": "^0.6.2",
|
||||||
|
"esbuild": "^0.11.15",
|
||||||
"eslint": "^7.7.0",
|
"eslint": "^7.7.0",
|
||||||
"eslint-plugin-import": "^2.22.0",
|
"eslint-plugin-import": "^2.22.0",
|
||||||
"eslint-plugin-node": "^11.1.0",
|
"eslint-plugin-node": "^11.1.0",
|
||||||
@ -25,9 +25,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-terser": "^7.0.2",
|
"rollup-plugin-esbuild": "^4.1.0",
|
||||||
"rollup-plugin-typescript2": "^0.30.0",
|
|
||||||
"rollup-plugin-vue": "^6.0.0-beta.11",
|
|
||||||
"stats.js": "0.17.0",
|
"stats.js": "0.17.0",
|
||||||
"three": "^0.127",
|
"three": "^0.127",
|
||||||
"tslib": "^2.2.0",
|
"tslib": "^2.2.0",
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
import path from 'path'
|
// import vue from 'rollup-plugin-vue'
|
||||||
import vue from 'rollup-plugin-vue'
|
import esbuild from 'rollup-plugin-esbuild'
|
||||||
import typescript from 'rollup-plugin-typescript2'
|
|
||||||
import replace from '@rollup/plugin-replace'
|
import replace from '@rollup/plugin-replace'
|
||||||
import { terser } from "rollup-plugin-terser"
|
|
||||||
|
|
||||||
// ensure TS checks only once for each build
|
|
||||||
let hasTSChecked = false
|
|
||||||
|
|
||||||
const input = 'src/export.ts'
|
const input = 'src/export.ts'
|
||||||
|
|
||||||
@ -40,20 +35,12 @@ const cdnReplaces = {
|
|||||||
delimiters: ['', ''],
|
delimiters: ['', ''],
|
||||||
}
|
}
|
||||||
|
|
||||||
function createConfig(format, output, plugins = []) {
|
function createConfig(format, output, plugins = [], minify = false) {
|
||||||
const tsPlugin = typescript({
|
const tsPlugin = esbuild({
|
||||||
check: false, // !hasTSChecked,
|
sourceMap: true,
|
||||||
cacheRoot: path.resolve(__dirname, 'node_modules/.tscache'),
|
minify,
|
||||||
tsconfigOverride: {
|
target: 'es2019',
|
||||||
compilerOptions: {
|
|
||||||
sourceMap: false, // !hasTSChecked,
|
|
||||||
declaration: false, // !hasTSChecked,
|
|
||||||
declarationMap: false, // !hasTSChecked,
|
|
||||||
},
|
|
||||||
include: [input],
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
hasTSChecked = true
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
input,
|
input,
|
||||||
@ -65,8 +52,8 @@ function createConfig(format, output, plugins = []) {
|
|||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
// vue(),
|
||||||
tsPlugin,
|
tsPlugin,
|
||||||
vue(),
|
|
||||||
...plugins,
|
...plugins,
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
@ -74,8 +61,8 @@ function createConfig(format, output, 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), terser()]),
|
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' }, [terser()]),
|
createConfig('es', { file: 'build/trois.module.min.js' }, [], true),
|
||||||
createConfig('cjs', { file: 'build/trois.js' }),
|
createConfig('cjs', { file: 'build/trois.js' }),
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user