我正在尝试设置webpack的开发服务器和HMR以与Shopify主题开发一起使用。运行服务器并打开本地IP时,我从Shopify的DNS提供商CloudFlare收到此错误。
如何正确设置Webpack以便将热更改(css / JS)注入代理的Shopify商店(mystore.myshopify.com网址)?
我的webpack配置如下:
const path = require("path");
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
module.exports = {
mode: "development",
devServer: {
contentBase: false,
hot: true,
https: true,
proxy: {
"**": {
target: "http://mystore.myshopify.com",
secure: false
}
},
},
entry: "./src/scripts/index.js",
output: {
filename: "./app.js",
path: path.resolve(__dirname, "dist")
},
plugins: [
],
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
// Creates `style` nodes from JS strings
'style-loader',
//postcss here (autoprefixer, babel etc)
// Translates CSS into CommonJS
'css-loader',
// Compiles Sass to CSS
'sass-loader',
],
},
],
},
};