Git Product home page Git Product logo

blog's People

Contributors

elfecho avatar

Watchers

 avatar  avatar

blog's Issues

vue框架开发出现页面空白、白屏的解决方法总汇

使用vue开发过一段时间了,采用 Vue-cli脚手架中出现一些页面空白问题的解决方法总汇

1.npm run build打包页面空白
我们会发现页面head中引用的js和css文件是出现了路径错误,这里修改如下:

解决位置:config/index.js文件:把assetsPublicPath: '/'改为assetsPublicPath: './'

build: {
    assetsPublicPath: './',
}
  1. iOS的Safari下无法打开网页
    webpack-dev-server >= 2.8.0 的版本在 iOS Safari 下无法打开网页,效果为白屏。

控制台报错:Can't find variable: SockJS 应该是 Safari 的 BUG,比如下面的代码就会抛出

Error eval("const a = function () {}; function b() { a(); }; b();")
解决方法
1.使用老版本:
yarn add webpack-dev-server@~2.7.0 -D
2.其它方法
yarn add babel-plugin-transform-es2015-block-scoping -D
修改 webpack 相关配置

{
  test: /\.js$/,
  loader: 'babel-loader',
  include: [
    ...,
    /node_modules\/webpack-dev-server/
  ]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.