【问题标题】:Webpack Config Found No Entry ConfiguredWebpack Config Found 没有配置条目
【发布时间】:2019-08-20 09:18:45
【问题描述】:

在我的 Ruby on Rails 项目中使用 Webpack 时遇到了一些问题。我正在关注 WebCrunch (https://web-crunch.com/lets-build-with-ruby-on-rails-project-management-app/) 上的教程系列。当我尝试运行 webpack-dev-server 时,我收到以下错误:

未找到配置文件,也未通过 CLI 选项配置条目。 使用 CLI 时,您至少需要提供两个参数:entry 和输出。配置文件可以命名为“webpack.config.js” 当前目录。使用 --help 显示 CLI 选项。

所以我改为运行 webpack-dev-server --config config/webpacker.yml 并收到此错误:

找到配置文件,但没有配置条目。使用 --help 来 显示 CLI 选项。

附件是我的 webpacker.yml 文件以及我的 package.json。我还要附上项目目录的截图。

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:
    - .coffee
    - .erb
    - .js
    - .jsx
    - .ts
    - .vue
    - .sass
    - .scss
    - .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: 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

package.json

{
  "name": "Groupie",
  "private": true,
  "dependencies": {
    "@rails/webpacker": "^3.2.0",
    "coffeescript": "1.12.7",
    "require-yaml": "0.0.1",
    "rvm": "^0.3.2",
    "vue": "^2.6.10",
    "vue-loader": "^15.7.0",
    "vue-template-compiler": "^2.6.10",
    "webpack": "^2.2.0",
    "webpack-dev-server": "^2.10.1"
  },
  "devDependencies": {}
}

更新:

运行 ./bin/webpack-dev-server 后出现以下错误:

配置对象无效。 Webpack 已使用 与 API 架构不匹配的配置对象。 - configuration.module 具有未知属性“strictExportPresence”。这些属性是有效的:object { exprContextCritical?, exprContextRecursive?, exprContextRegExp?, exprContextRequest?, loaders?, noParse?, rules?, unknownContextCritical?, unknownContextRecursive?, unknownContextRegExp?, unknownContextRequest?, unsafeCache?, WrappedContextCritical?, WrappedContextRecursive?, WrappedContextRegExp?影响正常模块的选项 (NormalModuleFactory)。

【问题讨论】:

  • 你找到解决方案了吗?

标签: ruby-on-rails web webpack webpack-dev-server


【解决方案1】:

你是否正确安装了 webpack?

bundle exec rails webpacker:install

要运行开发服务器,请使用以下命令:

./bin/webpack-dev-server

【讨论】:

  • 是的,我有,我现在收到一个新错误,我将更新我的问题。
猜你喜欢
  • 2017-11-05
  • 2019-12-16
  • 2019-11-09
  • 1970-01-01
  • 2016-12-29
  • 1970-01-01
  • 2022-11-06
  • 2020-07-05
  • 2016-05-11
相关资源
最近更新 更多