一切都已经有效,但现在只是我尝试导入驻留在app/assets/stylesheets/imports/_variables.scss
而不是当前文件的相对路径的scss文件;在Chrome控制台中给我一个错误:
这是我尝试导入它的行:
应用/ 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
时错误仍然存在
我很感激任何帮助或任何可能的调试过程。