mirror of
https://github.com/zh-lx/pinyin-pro.git
synced 2026-03-13 09:51:38 +08:00
Revert "feat: 打包工具迁移至 vite"
This commit is contained in:
14
package.json
14
package.json
@@ -7,7 +7,7 @@
|
||||
"typings": "./types/index.d.ts",
|
||||
"scripts": {
|
||||
"test": "mocha",
|
||||
"build": "tsc && vite build",
|
||||
"build": "rollup -c && rollup -c rollup.esm.config.js",
|
||||
"commit": "git-cz",
|
||||
"coverage": "istanbul cover _mocha -- -R spec --timeout 15000 --recursive",
|
||||
"coverage:check": "istanbul check-coverage",
|
||||
@@ -54,6 +54,9 @@
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^11.0.0",
|
||||
"@commitlint/config-conventional": "^11.0.0",
|
||||
"@rollup/plugin-commonjs": "^17.1.0",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^11.2.0",
|
||||
"@types/jest": "^26.0.20",
|
||||
"@typescript-eslint/eslint-plugin": "^4.26.0",
|
||||
"@typescript-eslint/parser": "^4.26.0",
|
||||
@@ -64,9 +67,12 @@
|
||||
"eslint": "^7.22.0",
|
||||
"istanbul": "^0.4.5",
|
||||
"mocha": "^8.3.2",
|
||||
"tslib": "^2.6.2",
|
||||
"typescript": "^4.2.3",
|
||||
"vite": "^4.4.11"
|
||||
"rollup": "2.60.0",
|
||||
"rollup-plugin-alias": "^2.2.0",
|
||||
"rollup-plugin-cleanup": "^3.2.1",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"rollup-plugin-typescript2": "^0.34.1",
|
||||
"typescript": "^4.2.3"
|
||||
},
|
||||
"config": {
|
||||
"commitizen": {
|
||||
|
||||
37
rollup.config.js
Normal file
37
rollup.config.js
Normal file
@@ -0,0 +1,37 @@
|
||||
import path from 'path';
|
||||
import json from '@rollup/plugin-json';
|
||||
import { terser } from 'rollup-plugin-terser';
|
||||
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
||||
import commonjs from '@rollup/plugin-commonjs'; // commonjs模块转换插件
|
||||
import cleanup from 'rollup-plugin-cleanup';
|
||||
import ts from 'rollup-plugin-typescript2';
|
||||
import alias from 'rollup-plugin-alias';
|
||||
|
||||
const plugins = [
|
||||
cleanup(),
|
||||
json(),
|
||||
nodeResolve(),
|
||||
ts({
|
||||
tsconfig: path.resolve(__dirname, './tsconfig.json'), // 导入本地ts配置
|
||||
clean: true,
|
||||
useTsconfigDeclarationDir: true,
|
||||
}),
|
||||
commonjs(),
|
||||
alias({
|
||||
entries: [{ find: '@', replacement: './lib' }],
|
||||
}),
|
||||
terser(),
|
||||
];
|
||||
|
||||
module.exports = {
|
||||
input: path.resolve('./lib/index.ts'),
|
||||
output: [
|
||||
{
|
||||
exports: 'auto',
|
||||
file: path.resolve(__dirname, './dist/index.js'),
|
||||
format: 'umd',
|
||||
name: 'pinyinPro',
|
||||
},
|
||||
],
|
||||
plugins,
|
||||
};
|
||||
33
rollup.esm.config.js
Normal file
33
rollup.esm.config.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import path from 'path';
|
||||
import json from '@rollup/plugin-json';
|
||||
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
||||
import commonjs from '@rollup/plugin-commonjs'; // commonjs模块转换插件
|
||||
import ts from 'rollup-plugin-typescript2';
|
||||
import alias from 'rollup-plugin-alias';
|
||||
|
||||
const plugins = [
|
||||
json(),
|
||||
nodeResolve(),
|
||||
ts({
|
||||
tsconfig: path.resolve(__dirname, './tsconfig.json'), // 导入本地ts配置
|
||||
clean: true,
|
||||
useTsconfigDeclarationDir: true,
|
||||
}),
|
||||
commonjs(),
|
||||
alias({
|
||||
entries: [{ find: '@', replacement: './lib' }],
|
||||
}),
|
||||
];
|
||||
|
||||
module.exports = {
|
||||
input: path.resolve('./lib/index.ts'),
|
||||
output: [
|
||||
{
|
||||
exports: 'auto',
|
||||
file: path.resolve(__dirname, './dist/index.mjs'),
|
||||
format: 'es',
|
||||
sourcemap: false,
|
||||
},
|
||||
],
|
||||
plugins,
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES5",
|
||||
"target": "es6",
|
||||
"module": "esnext",
|
||||
"strict": true,
|
||||
"jsx": "preserve",
|
||||
@@ -10,16 +10,13 @@
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"isolatedModules": false,
|
||||
"downlevelIteration": true,
|
||||
"sourceMap": false,
|
||||
"declaration": true,
|
||||
"declarationDir": "types",
|
||||
"emitDeclarationOnly": true,
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"@/*": ["lib/*"]
|
||||
}
|
||||
},
|
||||
"include": ["lib/**/*.ts"],
|
||||
"exclude": ["node_modules", "types"]
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import path from 'path';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
build: {
|
||||
lib: {
|
||||
entry: ['lib/index.ts'],
|
||||
formats: ['es', 'cjs'],
|
||||
fileName: 'index',
|
||||
name: 'pinyinPro',
|
||||
},
|
||||
|
||||
minify: true,
|
||||
emptyOutDir: true,
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, './lib'),
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user