vue2.0+webpack搭建的项目问题

soxiuzi
  • 19

在vue和webpack搭建的项目中,webpack目录没有dev-server.js,如何创建本地的express服务器?
现在的文档目录
图片描述

评论
阅读 585
2 个回答

把你现在的目录截个图贴上来

clipboard.png

{
"name": "sy-moblie",
"version": "1.0.0",
"description": "sy vue project",
"author": "Jay",
"private": true,
"scripts": {

"dev": "node build/dev-server.js",
"start": "npm run dev",
"build": "node build/build.js",
"unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
"e2e": "node test/e2e/runner.js",
"test": "npm run unit && npm run e2e"

},
"dependencies": {

"axios": "^0.17.1",
"echarts": "^3.8.5",
"element-ui": "^2.0.2",
"font-awesome": "^4.7.0",
"jquery": "^3.2.1",
"mint-ui": "^2.2.9",
"soshm": "^1.1.3",
"vue": "^2.5.2",
"vue-axios": "^2.0.2",
"vue-router": "^3.0.1",
"vue-scroll": "^2.1.6",
"vuex": "^3.0.1"

},

目录没有dev-server.js是什么意思?dev-server是webpack创建的一个服务器,只有webpack配置正确,就会创建

dev: {

    // Paths
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    headers: {
        'Access-Control-Allow-Origin': '*'
    },

    // Various Dev Server settings
    // host: 'liushaobo11.m.itcloudlab.vm', // can be overwritten by process.env.HOST
    // host: 'node.itcloudlab.vm', // can be overwritten by process.env.HOST
    host: '0.0.0.0', // can be overwritten by process.env.HOST
    port: 9090, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
    autoOpenBrowser: false,
    // disableHostCheck: true,
    // public: 'node.itcloudlab.vm',
    errorOverlay: true,
    notifyOnErrors: true,
    poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-

    // Use Eslint Loader?
    // If true, your code will be linted during bundling and
    // linting errors and warnings will be shown in the console.
    useEslint: true,
    // If true, eslint errors and warnings will also be shown in the error overlay
    // in the browser.
    showEslintErrorsInOverlay: false,

    /**
     * Source Maps
     */

    // https://webpack.js.org/configuration/devtool/#development
    devtool: 'eval-source-map',

    // If you have problems debugging vue-files in devtools,
    // set this to false - it *may* help
    // https://vue-loader.vuejs.org/en/options.html#cachebusting
    cacheBusting: true,

    // CSS Sourcemaps off by default because relative paths are "buggy"
    // with this option, according to the CSS-Loader README
    // (https://github.com/webpack/css-loader#sourcemaps)
    // In our experience, they generally work as expected,
    // just be aware of this issue when enabling this option.
    cssSourceMap: false,
  },
宣传栏