Webpacker gem`restered_pa​​ths`"找不到或不可读"导入scss文件时出错

时间:2017-11-08 14:59:34

标签: ruby-on-rails webpack webpacker

背景

  • Rails:5.1.4
  • 宝石:
    • webpacker:3.0.1
  • 包裹:
    • @ rails / webpacker:3.0.2
    • vue:2.5.2
    • vue-loader:13.3.0
    • vue-template-compiler:2.5.2
  • " JS开发相当新鲜;即webpack"

问题

一切都已经有效,但现在只是我尝试导入驻留在app/assets/stylesheets/imports/_variables.scss而不是当前文件的相对路径的scss文件;在Chrome控制台中给我一个错误:

enter image description here

这是我尝试导入它的行:

应用/ JavaScript的/游戏/卡/ Card.vue

<template>
...
</template>

<script>
...
</script>

<style lang='scss' scoped>
@import 'stylesheets/imports/variables';
...
</style>

我看了webpacker doc,因此我更新了我的 config / webpacker.yml resolved_paths,重新启动了rails server,但仍然失败。

配置/ 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: ['app/assets']

  # 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

  dev_server:
    host: localhost
    port: 3035
    hmr: false
    https: false
...

P.S。我正在运行rails server而未运行bin/webpack-dev-server,但在同时运行bin/webpack-dev-server 时错误仍然存​​在

我很感激任何帮助或任何可能的调试过程。

0 个答案:

没有答案