Webpack开发服务器ERR_ADDRESS_INVALID

时间:2018-07-16 12:00:54

标签: html css webpack sass webpack-dev-server

我的webpack-dev-server出现问题,它无法加载我的页面,并且每次加载时我都会收到ERR_ADDRESS_INVALID错误。 也许你们可以帮助我找出问题所在。 即时通讯中添加了我的日志,webpack.config和程序包。

这是我的 webpack.config:

var path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');


module.exports = {
  entry: './app/js/index.js',
  output: {
    path: path.join(__dirname, './app/js/newJs'),
    filename: 'newJs.js'
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        loader: 'babel-loader',
        exclude: /node_modules/
      },
      {
        test: /\.html$/,
        loader: 'html-loader'
      },
      {
        test: /\.css$/,
        loaders: ['style-loader', 'css-loader', 'sass-loader'],
      },
      {
        test: /\.scss$/,
        use: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: ['css-loader', 'sass-loader']
        })
      },
      {
        test: /\.(jpe?g|png|gif|svg)$/i,
        loaders:'url-loader',
        exclude: /node_modules/
      },
    ]
  },
        plugins: [
        new ExtractTextPlugin('myNewscss.css')
        ],
       devServer: {
       contentBase: path.resolve(__dirname, '.app/js/newJs'),
       inline:true,
       port:2000,
       host:"0.0.0.0",
       open:true
   }
}

这是 我的package.json:

{
  "name": "tix",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "webpack": "webpack",
    "dev": "webpack-dev-server",
    "start": "node server.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "body-parser": "^1.18.3",
    "express": "^4.16.3",
    "express-session": "^1.15.6",
    "jquery": "^3.3.1"
  },
  "engines": {
    "node": "8.9.3"
  },
  "devDependencies": {
    "babel-core": "^6.26.3",
    "babel-loader": "^7.1.5",
    "css-loader": "^1.0.0",
    "extract-text-webpack-plugin": "^4.0.0-beta.0",
    "file-loader": "^1.1.11",
    "html-loader": "^0.5.5",
    "install": "^0.12.1",
    "node-sass": "^4.9.2",
    "npm": "^6.2.0",
    "sass-loader": "^7.0.3",
    "style-loader": "^0.21.0",
    "url-loader": "^1.0.1",
    "webpack": "^4.16.1",
    "webpack-cli": "^3.0.8",
    "webpack-dev-server": "^3.1.4"
  }
}
这些是 我的日志:

i 「wds」: Project is running at http://127.0.0.1:2000/
i 「wds」: webpack output is served from /
i 「wds」: Content not from webpack is served from         C:\Users\User\Desktop\Projects\TIX\.app\js\newJs
i 「wdm」: wait until bundle finished: /
‼ 「wdm」: Hash: fee43669f56fbd1c0778
Version: webpack 4.16.1
Time: 1281ms
Built at: 2018-07-16 15:51:54
        Asset     Size  Chunks                    Chunk Names
     newJs.js  139 KiB       0  [emitted]         main
myNewscss.css  660 KiB       0  [emitted]  [big]  main
Entrypoint main [big] = newJs.js myNewscss.css
 [2] multi (webpack)-dev-server/client?http://127.0.0.1:2000     ./app/js/index.js 40 bytes {0} [built]
 [3] (webpack)-dev-server/client?http://127.0.0.1:2000 7.75 KiB {0} [built]
 [4] ./node_modules/url/url.js 22.8 KiB {0} [built]
 [8] ./node_modules/querystring-es3/index.js 127 bytes {0} [built]
[11] ./node_modules/strip-ansi/index.js 161 bytes {0} [built]
[12] ./node_modules/ansi-regex/index.js 135 bytes {0} [built]
[13] ./node_modules/loglevel/lib/loglevel.js 7.68 KiB {0} [built]
[14] (webpack)-dev-server/client/socket.js 1.05 KiB {0} [built]
[16] (webpack)-dev-server/client/overlay.js 3.58 KiB {0} [built]
[17] ./node_modules/ansi-html/index.js 4.16 KiB {0} [built]
[18] ./node_modules/html-entities/index.js 231 bytes {0} [built]
[21] (webpack)/hot sync nonrecursive ^\.\/log$ 170 bytes {0} [built]
[22] (webpack)/hot/log.js 1010 bytes {0} [optional] [built]
[23] (webpack)/hot/emitter.js 75 bytes {0} [built]
[25] ./app/js/index.js 32 bytes {0} [built]
    + 18 hidden modules

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for         this value. Set 'mode' option to 'development' or 'production' to enable defaults     for each environment.
You can also set it to 'none' to disable any default behavior. Learn more:     https://webpack.js.org/concepts/mode/

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
  myNewscss.css (660 KiB)

WARNING in entrypoint size limit: The following entrypoint(s) combined asset     size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  main (799 KiB)
      newJs.js
      myNewscss.css


WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to     lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
Child extract-text-webpack-plugin node_modules/extract-text-webpack-    plugin/dist node_modules/css-loader/index.js!node_modules/sass-    loader/lib/loader.js!app/style/styles.scss:
    Entrypoint undefined = extract-text-webpack-plugin-output-filename
    [0] ./node_modules/css-loader!./node_modules/sass-    loader/lib/loader.js!./app/style/styles.scss 3.06 KiB {0} [built]
    [1] ./node_modules/css-loader/lib/url/escape.js 448 bytes {0} [built]
    [2] ./node_modules/css-loader/lib/css-base.js 2.21 KiB {0} [built]
    [3] ./app/js/newJs/assets/61.jpg 657 KiB {0} [built]
i 「wdm」: Compiled with warnings.

0 个答案:

没有答案