运行Webpack开发服务器时浏览器返回404错误

问题描述

我在远程服务器上使用带有Webpacker的Rails 6。

运行bin/webpack-dev-server时,它返回:

ℹ 「wds」: Project is running at https://MY_HOST:3035/
ℹ 「wds」: webpack output is served from /packs/
ℹ 「wds」: Content not from webpack is served from /PATH/public/packs
ℹ 「wds」: 404s will fallback to /index.html`

访问URL时,打包URL返回404错误

https://MY_HOST/packs/js/application-HASH.js net::ERR_ABORTED 404 (Not Found)

当我使用bin/webpack --watch

时,效果很好

这是dev_server配置:

dev_server:
    https: true
    host: '0.0.0.0'
    port: 3035
    public: MY_HOST:3035
    hmr: false
    # Inline should be set to true if using HMR
    inline: true
    overlay: true
    compress: true
    disable_host_check: true
    use_local_ip: false
    quiet: false
    pretty: false
    headers:
      'Access-Control-Allow-Origin': '*'
    watch_options:
      ignored: '**/node_modules/**'

manifest.json散列与webpack开发服务器生成的散列相同。

我似乎无法理解问题所在。

我真的很感谢任何指针。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)