鍍金池/ 問答/HTML/ vue2.0+webpack搭建的項目問題

vue2.0+webpack搭建的項目問題

在vue和webpack搭建的項目中,webpack目錄沒有dev-server.js,如何創(chuàng)建本地的express服務(wù)器?
現(xiàn)在的文檔目錄
圖片描述

回答
編輯回答
毀與悔

把你現(xiàn)在的目錄截個圖貼上來

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"

},

2017年6月1日 07:43
編輯回答
挽歌

目錄沒有dev-server.js是什么意思?dev-server是webpack創(chuàng)建的一個服務(wù)器,只有webpack配置正確,就會創(chuàng)建

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,
  },
2018年5月23日 09:53