fix: external fonts are not included (due to side effects https://github.com/rollup/plugins/issues/692)

This commit is contained in:
07akioni 2020-12-07 23:49:32 +08:00
parent 203403e74d
commit 7a5e3f9bcc
4 changed files with 20 additions and 4 deletions

View File

@ -0,0 +1,8 @@
const packageJson = require('../package.json')
packageJson.sideEffects = false
require('fs-extra').writeFileSync(
require('path').resolve(__dirname, '..', 'package.json'),
JSON.stringify(packageJson, 0, 2) + '\n'
)

View File

@ -0,0 +1,8 @@
const packageJson = require('../package.json')
delete packageJson.sideEffects
require('fs-extra').writeFileSync(
require('path').resolve(__dirname, '..', 'package.json'),
JSON.stringify(packageJson, 0, 2) + '\n'
)

View File

@ -4,13 +4,12 @@
"description": "A Vue UI Framework. Caring About Styles, Themed, Batteries Included, Not Rather Slow.",
"main": "lib/index.js",
"module": "es/index.js",
"sideEffects": false,
"scripts": {
"start": "npm run dev",
"deprecated:build:icons": "npm run clean && node build/build-icons.js",
"build:js": "npm run gen-version && npm run clean && node build/before-build.js && rollup -c",
"build:package": "npm run gen-version && npm run clean && node build/build-icons.js && node build/before-build.js && rollup -c",
"build:site": "npm run build:package && ./build/before-build-site.sh && cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=4096 vite build && rm -rf node_modules/naive-ui && cp site/index.html site/404.html",
"build:site": "npm run build:package && ./build/before-build-site.sh && node build/restore-side-effects.js && cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=4096 vite build && rm -rf node_modules/naive-ui && cp site/index.html site/404.html && node build/clear-side-effects.js",
"build:doc": "npm run gen-version && npm run build && rm -rf build-doc/dist && cross-env NODE_ENV=production webpack --config build/webpack.doc.js",
"clean": "rm -rf site lib es src-mirror node_modules/naive-ui",
"dev": "npm run clean && npm run gen-version && cross-env NODE_ENV=development vite",
@ -95,5 +94,6 @@
"vooks": "^0.0.6",
"vue": "^3.0.4",
"vueuc": "^0.0.1"
}
},
"sideEffects": false
}

View File

@ -355,7 +355,7 @@
- [x] chrome date-picker overflow (focus({ preventScroll }))
- [x] slider 键盘好像会激活不该激活的 tooltip...
- [x] transfer 打包之后有问题
- [x] side effects = false 好像会影响 rollup 的打包(这让我很不安,要是生效 css 怎么办?要是不生效 JS 怎么办?) https://github.com/rollup/plugins/issues/692
- [x] side effects = false 好像会影响 rollup 的打包(这让我很不安,要是生效 css 怎么办?要是不生效 JS 怎么办?)(事实上确实会影响网站对于 fonts 的打包,只能先靠脚本凑活一下) https://github.com/rollup/plugins/issues/692
- [x] vue 在 $attrs 的处理上 dev 和 prod 还是有差别 https://github.com/vuejs/vue-next/issues/2741
## Info