ERROR in xxx.js from UglifyJs 问题 ERROR in app.bundle.js from UglifyJs Unexpected token: name «element», expected: punc «;» [app.bundle.js:106,8] 在用webpack对代码打包的时候报错,在网上找到了类似的答案,还是没有解决我的问题. 能解决大部分问题的链接 https://stackoverflow.com/questions/41254538/error-in-bundle-js-from-uglifyjs http://www.cnblogs.com/aredleave/p/7586911.html https://segmentfault.com/a/1190000011212544 按照以上方法对环境进行重新配置,依然报错!
1 2 3 4 |
ERROR in ./src/index.js Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module '@babel/core' babel-loader@8 requires Babel 7.x (the package '@babel/core'). If you'd like to use Babel 6.x ('babel-core'), you should install 'babel-loader@7'. |
报错原因 通过代码报错原因是 babel-loader 版本问题,因为 babel-loader 用的最新的版本,和 UglifyJs 不兼容. 解决方法 通过运行下面代码对babel-loader进行重新安装(低版本). npm install --save-dev babel-loader@7 通过修改后的package.json配置文件,亲测可以正确打包,无报错现象.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
{ "name": "kankan", "version": "1.0.0", "description": "kankan", "main": "webpack.config.js", "scripts": { "start": "webpack-dev-server --open --config webpack.dev.js", "build": "webpack --config webpack.prod.js" }, "author": "kankan", "license": "ISC", "devDependencies": { "babel": "^6.23.0", "babel-core": "^6.26.3", "babel-loader": "^7.1.5", "babel-preset-es2015": "^6.24.1", "clean-webpack-plugin": "^2.0.1", "css-loader": "^2.1.1", "express": "^4.16.4", "html-webpack-plugin": "^3.2.0", "style-loader": "^0.23.1", "uglifyjs-webpack-plugin": "^2.1.2", "webpack": "^4.30.0", "webpack-cli": "^3.3.1", "webpack-dev-middleware": "^3.6.2", "webpack-dev-server": "^3.3.1", "webpack-manifest-plugin": "^2.0.4", "webpack-merge": "^4.2.1" } } |
奇卡奇卡 哈哈哈 个人主页:https://kankan.fun from:https://blog.csdn.net/qq_38025939/article/details/89576282
View Detailsvue-cli构建项目使用sass报错 Module build failed: TypeError: this.getOptions is not a function 出现问题的原因是安装的sass-loader版本过高,选择安装较低版本的sass-loader即可。
1 |
npm install sass-loader@7.3.1 --save-dev |
Module build failed: Error: Node Sass version 6.0.1 is incompatible with ^4.0.0. 出现问题的原因是安装的sass版本过高,选择安装4.0+版本的sass即可。
1 |
npm install node-sass@4.14.1 --save-dev |
from:https://www.cnblogs.com/chenjy1225/p/14930870.html
View Details最近在学习vue框架,使用webpack打包vue项目,在执行npm run start的时候 出现如下错误: This dependency was not found: * !!vue-style-loader!css-loader?{"minimize":false,"sourceMap":false}!../../node_modules/vue-loader/lib/style-compiler/index?{"vue":true,"id":"data-v-1d57e5ea","scoped":false,"hasInlineConfig":false}!stylus-loader?{"sourceMap":false}!../../node_modules/vue-loader/lib/selector?type=styles&index=0!./a.vue in ./src/components/a.vue To install it, you can run: npm install --save !!vue-style-loader!css-loader?{"minimize":false,"sourceMap":false}!../../node_modules/vue-loader/lib/style-compiler/index?{"vue":true,"id":"data-v-1d57e5ea","scoped":false,"hasInlineConfig":false}!stylus-loader?{"sourceMap":false}!../../node_modules/vue-loader/lib/selector?type=styles&index=0!./a.vu 解决思路: npm install sass-loader --save; npm install node-sass --save; 然后运行npm run start就可以 from:https://www.cnblogs.com/hexiaobao/p/8260858.html
View Details首先在components文件夹中新建一个loading.vue组件: 1.loading.vue组件内容如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
<template> <div class="markbox" v-show="loading" style="background-color: rgba(0, 0, 0, 0.5);"> <div class="sun-loading"></div> </div> </template> <script> export default { name: 'loading', data() { return { loading: false } }, created() { var that = this; this.bus.$on('loading', function(data) { that.loading = !!data; }) } } </script> |
css代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
/*loading开始*/ .sun-loading { width: 45px; height: 45px; display: block; animation: sunLoading 1s steps(12, end) infinite; background: transparent url('data:image/gif;base64,R0lGODlhQABAAKUAAAQCBFxeXDQyNIyKjBwaHHR2dExKTKSipAwODGxqbDw+PJSWlCQmJISChFRWVKyurAwKDGRmZDw6PJSSlCQiJHx+fFRSVKyqrBQWFHRydERGRJyenCwuLAQGBGRiZDQ2NIyOjBweHHx6fExOTKSmpBQSFGxubERCRJyanCwqLISGhFxaXLSytAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJCQAtACwAAAAAQABAAAAG/sCWcEgsGo9CjsWSQjqf0KiTYRhVKdKsdnuqVgXbsPjYtY4+43SR4olYEM6T2SBxIiQfBUaNRET+EQ5xXmdOHwKIEh18RikRCY8RTWSEdUcUAoeHWIxEGH9tER4ARwojVgZoRh0SiIgfcJ1EI5AJbQpkZiOWRSmaiByyRSWif7axRHJevEN3AhyayMJCJ4+hBkbKVsxCzx+aDNNFHaGQESFFZVXcBIeuH4viRBygj4LJc8wAv4fo8kUrrP0JNkQbHSIMXEFTpQZCij1OQpQTFa+FQV6sNH2DiAQDhYpGGIioUMFBCScGQNnCJUSChg8uwSRxB43gkRIUCBCgcPJI/oEGFYCKOEHKiB9bgIoigaAgUyYJEI50oBCCAAarNouQBAq0QoGsQySAEqDUCQAGrQSEMxKCgc6rV9caSbA1qN0IBIoA8GAAZJQOmcq2wODW6ludcofRJWk3qAgLUYdEFjO5BYLCVw1bZSDNiICRDUR0JSlCgWA1AEJQgKuZsD8oHQyMtMu1gonKaS7r1GyVAgO/UEqsqM31Xie3ma+27ayFwmKSBXA3RI6YoxoJoLkxesvgdScIIwqc5tOBw+9/wDuN/8e+vfsoAgJ4mE+//nxs7ENgKLG/P///CJxkAAoLoECggQUeSKAH7eUlBQYgIIjgBgRSmOAI7fUUBQER/ha4gIUSHmhBe8whEcIIFSqY4IcLNpjFHvHNV0wbNLaB3z/6/eeffwG+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U9EIETGBQgHwlkAiUAaUYwICoLG0gkwqgmWESCqA+wakQIHMiWxQD2UTNEBaImPIQB9uU6nQIIsqBCERXUp7EQAIBQ76/MNTtqvy3ER9/JQnBg3wKxnrECgfPRLETJMxuBcX3KsoPBtaPedHDQRWAwMAly+iKiqA4cISLTRQQwsM+cEDAwzkcM3fMRHbhMYNSLSFAxElePfQTI9enIh7UVjsy2yU6AUCEJOW/BAQoPVCAb0G4fgYEKDywAc49CyFw442C0zcK9kIcB93wsV67FCJlK+EwQADtUOWFJRjZRTUdLT3ZvQmJwaW9RWTRZNHZYV2lSM0dVdlpsZUxtWU5rbkt4aVAvY1QwekJNNTZaY2tKWDZOaURM'); background-size: 100%; margin:auto; position:absolute; top: 0; left: 0; bottom: 0; right:0; } /*loading结束*/ |
2.app.vue中设置:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<template> <div id="app"> <router-view/> <loading></loading> </div> </template> <script> import loading from '@/components/common/loading' export default { name: 'App', components:{loading} } </script> |
3.在main.js中设置
1 |
Vue.prototype.bus = new Vue; |
4.在.vue组件中使用
1 2 3 4 5 6 7 8 9 |
// 显示loading this.bus.$emit('loading', true); // 关闭loading this.bus.$emit('loading', false); |
效果如下: from:https://blog.csdn.net/liangmengbk/article/details/90201596
View Details1、首先 npm install babel-plugin-import 和 npm install vant 2、样式在项目中的 .babelrc 文件下 ["import", {"libraryName": "vant","libraryDirectory": "es","style": true}, "vant"]] //vant样式引用 3、在main.js中 import { Button } from 'vant' //引用vant组件库中可用组件 Vue.use(Button ) 注册组件即可。 from:https://www.cnblogs.com/1rookie/p/12660684.html
View Details解决办法参考:https://github.com/babel/babel-preset-env/issues/186 即在命令行输入命令安装模块:npm install babel-preset-env from:https://blog.csdn.net/acoolgiser/article/details/88814071
View Details第一步
1 |
npm install vue-signature |
第二步 main.js
1 2 |
import vueSignature from "vue-signature" Vue.use(vueSignature) |
vue
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
<template> <div id="app"> <vueSignature ref="signature" :sigOption="option" :w="'800px'" :h="'400px'" :disabled="disabled" :defaultUrl="dataUrl" ></vueSignature> <vueSignature ref="signature1" :sigOption="option"></vueSignature> <button @click="save">Save</button> <button @click="clear">Clear</button> <button @click="undo">Undo</button> <button @click="addWaterMark">addWaterMark</button> <button @click="handleDisabled">disabled</button> </div> </template> <script> export default { name: "app", data() { return { option: { penColor: "rgb(0, 0, 0)", backgroundColor: "rgb(255,255,255)", }, disabled: false, dataUrl: "https://avatars2.githubusercontent.com/u/17644818?s=460&v=4", }; }, methods: { save() { var _this = this; var png = _this.$refs.signature.save(); var jpeg = _this.$refs.signature.save("image/jpeg"); var svg = _this.$refs.signature.save("image/svg+xml"); console.log(png); console.log(jpeg); console.log(svg); }, clear() { var _this = this; _this.$refs.signature.clear(); }, undo() { var _this = this; _this.$refs.signature.undo(); }, addWaterMark() { var _this = this; _this.$refs.signature.addWaterMark({ text: "mark text", // watermark text, > default '' font: "20px Arial", // mark font, > default '20px sans-serif' style: "all", // fillText and strokeText, 'all'/'stroke'/'fill', > default 'fill fillStyle: "red", // fillcolor, > default '#333' strokeStyle: "blue", // strokecolor, > default '#333' x: 100, // fill positionX, > default 20 y: 200, // fill positionY, > default 20 sx: 100, // stroke positionX, > default 40 sy: 200, // stroke positionY, > default 40 }); }, fromDataURL(url) { var _this = this; _this.$refs.signature.fromDataURL( "data:image/png;base64,iVBORw0K..." ); }, handleDisabled() { var _this = this; _this.disabled = !_this.disabled; }, }, }; </script> |
from:https://blog.csdn.net/XLL20001022/article/details/101548655
View Details问题描述: 自己在自学vue做项目的过程中,遇到一个有关背景图片路径的问题,就是css代码中背景图片是根据相对路径来写的,如下图: 当使用npm run dev命令本地访问的时候,背景图片是正常显示的,可使用npm run build命令打包后,访问dist目录下的项目,页面背景图路径就不对了,显示不出背景图。如下两张图对比 图一:使用npm run dev命令访问 图二:使用npm run build命令打包之后,访问dist目录下的文件,出现的问题,背景图片路径变成了http://127.0.0.1:9000/static/css/static/img/login-bg.0271ef1.jpeg,而实际在dist目录下,图片路径是这样的,如下图 解决办法: 解决办法为:只需要在build/utils.js文件中添加如下一行代码即可。
1 |
publicPath:'../../' |
添加位置为如下图: 然后重新执行 npm run build 命令,即可成功显示图片 from:https://www.cnblogs.com/libo0125ok/p/9361038.html
View Details备注:<=> 意为等价于; 1、npm install <=> npm i --save <=> -S --save-dev <=> -D npm run start <=> npm start // 对应"scripts"里的"start"命令 少敲几下键盘,何乐而不为 2、npm i --save-dev <packname> 工程构建(开发时、“打包”时)依赖 ;例:xxx-cli , less-loader , babel-loader… 3、npm i --save <packname> 项目(运行时、发布到生产环境时)依赖;例:antd , element,react… 4、对应关系如下(至于我们啥时候用--save、啥时候用--save-dev 感觉是个规范问题,用反了项目一样可以跑起来(对于安装依赖正确时),但会给其他看你项目的人带来误解、可能会导致一些bug的出现,还有一些配置的错乱等) 5、使用 npm i 安装package.json里的依赖时,两部分的包都会pull下来 5-1、使用 --prod、 npm i --prod <=> npm i --production // 仅会拉取dependencies中的依赖 5-2、设置NODE_DEV=production时 // 效果同上,仅会拉取dependencies中的依赖 (注意等号两边没空格) 5-2-1、命令行设置(注意不同环境时的"分割符") window => cmd :set NODE_ENV=production && xxxx mac => shell : NODE_ENV=production 空格 xxxx 5-2-2、package.json=>script命令中设置 彩蛋:在新建package.json文件时,我们可以使用npm init -y 快速创建(yes 表示一路默认创建,还有 -f 表示 force) from:https://blog.csdn.net/jwl_willon/article/details/81054978
View Details