Skip to content

“webpack dev_server configuration not found“ error during production build #2810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
phacks opened this issue Dec 16, 2020 · 1 comment
Closed

Comments

@phacks
Copy link

phacks commented Dec 16, 2020

Hi folks!

I’m hitting an error in Heroku CI that prevents the assets build:

Compilation failed:
yarn run v1.22.10
$ ./bin/webpack-dev-server --config /tmp/build_706ee277_/config/webpack/production.js
webpack dev_server configuration not found in /tmp/build_706ee277_/config/webpacker.yml[production].
Please run bundle exec rails webpacker:install to install Webpacker

The error makes sense insofar as there is no dev_server configuration for the production environment (and there shouldn’t be), but I don’t know why it even tries to look it up and run the dev server in the first place.

Webpacker is installed (I have all the bin/ and the configs), I’m running [email protected], and here’s my config/webpacker.yml:

config/webpacker.yml, click to expand
# Note: You must restart bin/webpack-dev-server for changes to take effect

default: &default
  source_path: app/javascript
  source_entry_path: packs
  public_root_path: public
  public_output_path: packs
  cache_path: tmp/cache/webpacker
  check_yarn_integrity: false
  webpack_compile_output: true

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

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

  # Extract and emit a css file
  extract_css: false

  static_assets_extensions:
    - .jpg
    - .jpeg
    - .png
    - .gif
    - .tiff
    - .ico
    - .svg
    - .eot
    - .otf
    - .ttf
    - .woff
    - .woff2

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

development:
  <<: *default
  compile: true

  # Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules
  check_yarn_integrity: 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
    pretty: false
    headers:
      "Access-Control-Allow-Origin": "*"
    watch_options:
      ignored: "**/node_modules/**"

test:
  <<: *default
  compile: 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

  # Extract and emit a css file
  extract_css: true

  # Cache manifest.json for performance
  cache_manifest: true

I can provide more details if needed, and I will update this issue should I find something.

Thanks!

@phacks phacks changed the title “webpack dev_server configuration not found for” production build “webpack dev_server configuration not found“ error during production build Dec 16, 2020
@phacks
Copy link
Author

phacks commented Dec 16, 2020

Issue was that webpacker was listed under DevDependencies instead of Dependencies (see #117 and #1751). Second time this bit me, I need to write it down on a post-it note and forever display it on top of my monitor 😅

@phacks phacks closed this as completed Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant