Roots Discourse

Fix for header Access-Control-Allow-Origin

webpack
sage9

#1

Hello,

I got a fix for the Header: Access-Control-Allow-Origin.

Add the next lines to the webpack.config.watch.js, in the module.exports = {}

  devServer: {
      headers: {
          'Access-Control-Allow-Origin': '*'
      }
  },

My complete module.exports = {} now looks like:

module.exports = {
  output: {
    pathinfo: true,
    publicPath: config.proxyUrl + config.publicPath,
  },
  devServer: {
      headers: {
          'Access-Control-Allow-Origin': '*'
      }
  },
  devtool: '#cheap-module-source-map',
  stats: false,
  plugins: [
    new webpack.optimize.OccurrenceOrderPlugin(),
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NoEmitOnErrorsPlugin(),
    new BrowserSyncPlugin({
      target,
      open: config.open,
      proxyUrl: config.proxyUrl,
      watch: config.watch,
      delay: 500,
    }),
  ],
};

Let me kmow if it works for you! :slight_smile: