1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 04:12:02 +08:00

rollup typescript plugin

This commit is contained in:
Kevin Levron 2021-04-21 21:05:49 +02:00
parent 86c51ef9bd
commit d91ba988ed
2 changed files with 12 additions and 9 deletions

View File

@ -9,6 +9,7 @@
"devDependencies": {
"@rollup/plugin-buble": "^0.21.3",
"@rollup/plugin-replace": "^2.3.3",
"@rollup/plugin-typescript": "^8.2.1",
"@types/three": "^0.127.1",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",

View File

@ -1,10 +1,11 @@
// import commonjs from '@rollup/plugin-commonjs';
import vue from 'rollup-plugin-vue';
import vue from 'rollup-plugin-vue'
// import buble from '@rollup/plugin-buble';
import { terser } from "rollup-plugin-terser";
import replace from '@rollup/plugin-replace';
import { terser } from "rollup-plugin-terser"
import replace from '@rollup/plugin-replace'
import typescript from '@rollup/plugin-typescript'
const input = 'src/export.js';
const input = 'src/export.ts'
const external = [
'three',
'three/examples/jsm/controls/OrbitControls.js',
@ -27,22 +28,23 @@ const external = [
'three/examples/jsm/shaders/FXAAShader.js',
'three/examples/jsm/webxr/VRButton.js',
'vue',
];
]
const cdnReplaces = {
'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/examples': 'from \'https://unpkg.com/three@0.127.0/examples',
delimiters: ['', ''],
};
}
const plugins = [
typescript(),
vue(),
// buble({
// transforms: { asyncAwait: false, forOf: false },
// objectAssign: 'Object.assign',
// }),
];
]
export default [
{
@ -105,8 +107,8 @@ export default [
output: {
format: 'cjs',
file: 'build/trois.js',
sourcemap: false,
sourcemap: true,
},
plugins,
},
];
]