微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

将Rails / webpacker配置转换为独立的webpack配置

如何解决将Rails / webpacker配置转换为独立的webpack配置

我需要将rails / webpacker配置转换为独立的webpack配置。

我有这个webpacker.yml文件

# Note: You must restart bin/webpack-dev-server for changes to take effect

default: &default
  source_path: app/javascript
  source_entry_path: packs
  public_output_path: packs
  cache_path: tmp/cache/webpacker

  # Additional paths webpack should lookup modules
  # ['app/assets','engine/foo/app/assets']
  resolved_paths: []

  # Reload manifest.json on all requests so we reload latest compiled packs
  cache_manifest: false

  extensions:
    - .js
    - .sass
    - .scss
    - .css
    - .module.sass
    - .module.scss
    - .module.css
    - .png
    - .svg
    - .gif
    - .jpeg
    - .jpg

development:
  <<: *default
  compile: true

  # Reference: https://webpack.js.org/configuration/dev-server/
  dev_server:
    https: false
    host: localhost
    port: 3035
    public: localhost: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
    headers:
      'Access-Control-Allow-Origin': '*'
    watch_options:
      ignored: /node_modules/


test:
  <<: *default
  compile: false
  cache_manifest: true

  # Compile test packs to a separate directory
  public_output_path: packs-test

production:
  <<: *default

  # Production depends on precompilation of packs prior to booting for performance.
  compile: false

  # Cache manifest.json for performance
  cache_manifest: true

我有这个树形结构

enter image description here

要在没有后端的情况下轻松地在本地工作,我已经检索了主页的来源,但是也许我需要以不同的方式配置js和css的包含内容

        <script src="/packs/application-d914eeaa42a3f0c888fe.js"></script>
        <link rel="stylesheet" media="all" href="/packs/application-757740dea9d7c88417aa94ed3d8f7690.css" />

        <link rel="stylesheet" media="all" href="/packs/stylesheets/application-b282b723d7a0b82ce40cab7f50cf8861.css" />

谢谢

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。