xm2by / vue-cmpt-template Goto Github PK
View Code? Open in Web Editor NEWProject template for vue-cmpt-cli
Project template for vue-cmpt-cli
使用rollup打包项目时,报如下错误:
[!] (plugin uglify) Error: Unexpected token: keyword «const»
SyntaxError: Unexpected token: keyword «const»
项目中devDependence、rollup和babel的配置如下:
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@commitlint/cli": "^8.1.0",
"@commitlint/config-conventional": "^8.1.0",
"babel-eslint": "^10.0.2",
"commitizen": "^4.0.3",
"cz-conventional-changelog": "^3.0.2",
"eslint": "^6.1.0",
"eslint-config-standard": "^13.0.1",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^9.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^5.2.3",
"husky": "^3.0.1",
"rollup": "^1.17.0",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-commonjs": "^10.0.1",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-terser": "^5.1.1",
"rollup-plugin-uglify": "^6.0.2",
"rollup-plugin-vue": "^5.0.1",
"vuepress": "^1.0.2"
}
// rollup.config.js文件
import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
import babel from 'rollup-plugin-babel'
import { uglify } from 'rollup-plugin-uglify'
import { terser } from 'rollup-plugin-terser'
import vuePlugin from 'rollup-plugin-vue'
export default {
input: './src/index.js',
output: [
{
file: 'dist/bundle.js',
name: 'bundle',
format: 'umd',
sourcemap: true
}
],
plugins: [
resolve(),
commonjs(),
babel({
exclude: 'node_modules/**'
}),
uglify(),
terser(),
vuePlugin()
]
}
{
"presets": [
["@babel/preset-env", {
"modules": false
}]
]
}
运行npm run build
打包项目时报如下错误:
[!] Error: You must supply "output.name" for UMD bundles.
Error: You must supply "output.name" for UMD bundles.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.