Commit d08b360d by xuzhenzhao

chore(custom): replace rollup

parent 3f567046
......@@ -4,7 +4,7 @@
"description": "",
"main": "./dist/index.mjs",
"scripts": {
"lib": "npx vite build",
"lib": "npx rollup -c",
"test": "npx jest __tests__",
"doc": "npx typedoc",
"prepublishOnly": "npm run lib"
......@@ -38,17 +38,19 @@
},
"devDependencies": {
"@jest/globals": "^28.1.3",
"@types/blueimp-md5": "^2.18.0",
"@types/consola": "^2.2.5",
"@types/jest": "^28.1.6",
"ts-jest": "^28.0.7",
"vite-plugin-dts": "^1.4.1",
"@types/blueimp-md5": "^2.18.0",
"@types/js-cookie": "^3.0.2",
"@types/node": "^18.6.2",
"@types/qs": "^6.9.7",
"jest": "^28.1.3",
"jest-environment-jsdom": "^28.1.3",
"rollup": "^2.78.1",
"rollup-plugin-typescript2": "^0.32.1",
"ts-jest": "^28.0.7",
"ts-node": "^10.9.1",
"tslib": "^2.4.0",
"typedoc": "^0.23.9",
"typedoc-theme-hierarchy": "^3.0.0",
"typescript": "^4.7.4"
......
import typescript from 'rollup-plugin-typescript2'
export default [
{
input: 'src/index.ts',
output: {
file: 'dist/index.mjs',
format: 'esm'
},
plugins: [
typescript()
]
},
{
input: 'src/index.ts',
output: {
file: 'dist/index.umd.js',
name: 'YDLToolKit',
format: 'umd'
},
plugins: [typescript()]
}
]
\ No newline at end of file
......@@ -12,7 +12,7 @@
/* Language and Environment */
"target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
"lib": ["es5", "DOM"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
......@@ -25,9 +25,9 @@
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
/* Modules */
"module": "commonjs", /* Specify what module code is generated. */
"module": "ESNext", /* Specify what module code is generated. */
// "rootDir": "./", /* Specify the root folder within your source files. */
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
"baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
"paths": {
"@/*": ["src/*"]
......
import path from 'path'
import { defineConfig } from 'vite'
import dts from 'vite-plugin-dts'
export default defineConfig(() => {
return {
resolve: {
alias: {
'@': path.resolve(__dirname, './src')
}
},
build: {
target: 'es2015',
lib: {
entry: path.resolve(__dirname, 'src/index'),
name: 'toolkit',
fileName: 'index',
formats: ['es', 'umd'],
sourcemap: 'inline'
},
outDir: path.resolve(__dirname, 'dist')
},
plugins: [dts()]
}
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment