How to override package.json main field

2019-03-30 10:38发布

问题:

How can I override the main field of package.json like in bower?

"overrides": {
  "highcharts": {
    "main": "highcharts.js"
  }
}

回答1:

Try creating an alias with the same name as the module in your Webpack config.

module.exports = {
    ...
    resolve: {
        alias: {
            "highcharts": path.resolve(__dirname, "path/to/file")
        }
    },
    ...
};