javascript - 使用vue-cli开发的网站,源码全都暴露在浏览器中?

查看:152
本文介绍了javascript - 使用vue-cli开发的网站,源码全都暴露在浏览器中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

webpack原来把js打包压缩混淆源码的优势呢?

是我使用的姿势不对吗?

望指教~~~

------------update-------

这是build的源码。。。

-----------update--------

已将config/index.js下的productionSourceMap设为false了。

build: {
    env: require('./prod.env'),
    index: path.resolve(__dirname, '../dist/index.html'),
    assetsRoot: path.resolve(__dirname, '../dist'),
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    productionSourceMap: false,
    // Gzip off by default as many popular static hosts such as
    // Surge or Netlify already gzip all static assets for you.
    // Before setting to `true`, make sure to:
    // npm install --save-dev compression-webpack-plugin
    productionGzip: false,
    productionGzipExtensions: ['js', 'css']
  },

解决方案

结帖!!!感谢各位~~~

将config/index.js下的build的productionSourceMap设为false即可!!!

这篇关于javascript - 使用vue-cli开发的网站,源码全都暴露在浏览器中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆