mirror of
https://github.com/bs-community/blessing-skin-plugins.git
synced 2025-01-08 11:37:27 +08:00
webpack -> Rollup (again)
This commit is contained in:
parent
f2aa09ad7c
commit
752d649d0b
5
.vscode/extensions.json
vendored
Normal file
5
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
"svelte.svelte-vscode"
|
||||||
|
]
|
||||||
|
}
|
9
.vscode/tasks.json
vendored
9
.vscode/tasks.json
vendored
@ -2,14 +2,19 @@
|
|||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"tasks": [
|
"tasks": [
|
||||||
{
|
{
|
||||||
"label": "Run webpack for plugin assets",
|
"label": "Build plugin assets",
|
||||||
"type": "process",
|
"type": "process",
|
||||||
"command": "yarn",
|
"command": "yarn",
|
||||||
"args": [
|
"args": [
|
||||||
"dev",
|
"dev",
|
||||||
"-o",
|
"-d",
|
||||||
"../blessing-skin-server/public/plugins"
|
"../blessing-skin-server/public/plugins"
|
||||||
],
|
],
|
||||||
|
"options": {
|
||||||
|
"env": {
|
||||||
|
"NODE_ENV": "development"
|
||||||
|
}
|
||||||
|
},
|
||||||
"isBackground": true,
|
"isBackground": true,
|
||||||
"problemMatcher": []
|
"problemMatcher": []
|
||||||
}
|
}
|
||||||
|
26
package.json
26
package.json
@ -8,26 +8,26 @@
|
|||||||
"plugins/*"
|
"plugins/*"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "webpack -d -w",
|
"dev": "rollup -c -w",
|
||||||
"build": "webpack -p"
|
"build": "rollup -c"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gplane/tsconfig": "^1.1.0",
|
"@gplane/tsconfig": "^1.1.0",
|
||||||
"@types/gulp": "^4.0.6",
|
"@rollup/plugin-commonjs": "^15.0.0",
|
||||||
|
"@rollup/plugin-node-resolve": "^9.0.0",
|
||||||
|
"@rollup/plugin-typescript": "^5.0.2",
|
||||||
"@types/node": "^14.0.13",
|
"@types/node": "^14.0.13",
|
||||||
"@types/react": "^16.9.32",
|
"@types/react": "^16.9.32",
|
||||||
"@types/react-dom": "^16.9.6",
|
"@types/react-dom": "^16.9.6",
|
||||||
"@types/webpack": "^4.41.17",
|
|
||||||
"css-loader": "^4.2.1",
|
|
||||||
"fast-glob": "^3.2.4",
|
"fast-glob": "^3.2.4",
|
||||||
"sass": "^1.26.10",
|
"rollup": "^2.26.5",
|
||||||
"sass-loader": "^9.0.3",
|
"rollup-plugin-svelte": "^6.0.0",
|
||||||
"style-loader": "^1.2.1",
|
"rollup-plugin-terser": "^7.0.0",
|
||||||
"ts-loader": "^8.0.1",
|
"svelte": "^3.24.1",
|
||||||
"ts-node": "^8.10.2",
|
"svelte-check": "^1.0.26",
|
||||||
"typescript": "^4.0.2",
|
"svelte-preprocess": "^4.1.1",
|
||||||
"webpack": "^5.0.0-beta.18",
|
"tslib": "^2.0.1",
|
||||||
"webpack-cli": "^4.0.0-beta.8"
|
"typescript": "^4.0.2"
|
||||||
},
|
},
|
||||||
"prettier": {
|
"prettier": {
|
||||||
"printWidth": 80,
|
"printWidth": 80,
|
||||||
|
55
rollup.config.js
Normal file
55
rollup.config.js
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
// @ts-check
|
||||||
|
import glob from 'fast-glob'
|
||||||
|
import typescript from '@rollup/plugin-typescript'
|
||||||
|
import resolve from '@rollup/plugin-node-resolve'
|
||||||
|
import commonjs from '@rollup/plugin-commonjs'
|
||||||
|
import { terser } from 'rollup-plugin-terser'
|
||||||
|
import svelte from 'rollup-plugin-svelte'
|
||||||
|
import sveltePreprocess from 'svelte-preprocess'
|
||||||
|
|
||||||
|
const isDev = process.env.NODE_ENV === 'development'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} name
|
||||||
|
* @param {string} path
|
||||||
|
*
|
||||||
|
* @returns {import('rollup').RollupOptions}
|
||||||
|
*/
|
||||||
|
function makeConfig(name, path) {
|
||||||
|
return {
|
||||||
|
input: { [name]: path },
|
||||||
|
output: {
|
||||||
|
dir: './plugins',
|
||||||
|
format: 'iife',
|
||||||
|
globals: {
|
||||||
|
'blessing-skin': 'blessing',
|
||||||
|
react: 'React',
|
||||||
|
'react-dom': 'ReactDOM',
|
||||||
|
},
|
||||||
|
indent: ' ',
|
||||||
|
},
|
||||||
|
external: ['react', 'react-dom', 'blessing-skin'],
|
||||||
|
plugins: [
|
||||||
|
typescript(),
|
||||||
|
svelte({
|
||||||
|
preprocess: sveltePreprocess(),
|
||||||
|
}),
|
||||||
|
resolve({ browser: true }),
|
||||||
|
commonjs(),
|
||||||
|
!isDev && terser(),
|
||||||
|
],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default glob([
|
||||||
|
'plugins/*/assets/**/*.ts',
|
||||||
|
'plugins/*/assets/**/*.tsx',
|
||||||
|
'!plugins/*/assets/**/*.test.ts',
|
||||||
|
'!**/*.d.ts',
|
||||||
|
]).then((files) =>
|
||||||
|
files.map((file) => {
|
||||||
|
const name = file.replace('plugins/', '').replace(/\.tsx?$/g, '')
|
||||||
|
|
||||||
|
return makeConfig(name, file)
|
||||||
|
}),
|
||||||
|
)
|
@ -8,15 +8,11 @@
|
|||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"blessing-skin": ["./types"]
|
"blessing-skin": ["./types"]
|
||||||
}
|
},
|
||||||
|
"types": ["svelte"]
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"plugins/*/assets",
|
"plugins/*/assets",
|
||||||
"types.ts"
|
"types.ts"
|
||||||
],
|
]
|
||||||
"ts-node": {
|
|
||||||
"compilerOptions": {
|
|
||||||
"module": "commonjs"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user