webpack-dev-server将哈希查询参数添加到src文件URL

时间:2017-12-04 15:08:30

标签: webpack query-string webpack-dev-server source-maps

当我打开chrome调试器时,我可以看到带有查询参数的源文件,如下所示: 组件one.js?64f5

什么是?64f5 ,如何将其删除?

webpack dev config:

var webpack = require('webpack');
var path = require('path');

module.exports = {
    entry: [
        path.join(__dirname, './main.js')
    ],
    output: {
        path: path.resolve(__dirname, "build"),
        publicPath: "/assets/",
        filename: "bundle.js"
    },
    module: {
        loaders: [{
            test: /\.(js|jsx)$/,
            exclude: /node_modules/,
            loader: 'babel-loader'
        }],
    },
}

的package.json:

    {
      "name": "cards-framework",
      "version": "1.0.0",
      "main": "bundle.js",
      "scripts": {
        "build": "webpack",
        "dev": "webpack-dev-server --config webpack.dev.config.js -d --open --hot"
      },
      "author": "",
      "license": "ISC",
      "dependencies": {
        "react": "^16.2.0",
        "react-dom": "^16.2.0"
      },
      "devDependencies": {...
      }
    }

1 个答案:

答案 0 :(得分:0)

我有同样的问题。对我来说,它可以通过以下方式解决:

.shape