Skip to content
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

Imports in less are added as dependencies with relative paths but webpack requires absolute paths #495

Closed
lundal opened this issue Apr 1, 2022 · 0 comments

Comments

@lundal
Copy link
Contributor

lundal commented Apr 1, 2022

Describe the bug
Imports in less are added as dependencies with relative paths ("node_modules/package/file.less"), but webpack requires absolute paths ("/home/user/project/node_modules/package/file.less").

Logs

WARNING in ./app/App.svelte
Invalid dependencies have been reported by plugins or loaders for this module. All reported dependencies need to be absolute paths.
Invalid dependencies may lead to broken watching and caching.
As best effort we try to convert all invalid values to absolute paths and converting globs into context dependencies, but this is deprecated behavior.
Loaders: Pass absolute paths to this.addDependency (existing files), this.addMissingDependency (not existing files), and this.addContextDependency (directories).
Plugins: Pass absolute paths to fileDependencies (existing files), missingDependencies (not existing files), and contextDependencies (directories).
Globs: They are not supported. Pass absolute path to the directory as context dependencies.
The following invalid values have been reported:
 * "node_modules/package/file.less"
 @ ./app/App.svelte
 @ ./app/app.js

To Reproduce
Use webpack with svelte-loader and svelte-preprocess:

{
  loader: "svelte-loader",
  options: {
    preprocess: sveltePreprocess(),
  },
},

Use an import within less in a svelte file:

<style lang="less">
  @import "package/file.less"
  ...
</style>

During build, webpack will complain about invalid dependencies.

Example that reproduces the error: https://github.com/lundal/svelte-less-example ($ yarn install && yarn build)

Expected behavior
No complaints from webpack

lundal added a commit to lundal/svelte-preprocess that referenced this issue Apr 1, 2022
lundal added a commit to lundal/svelte-preprocess that referenced this issue Apr 1, 2022
kaisermann pushed a commit that referenced this issue Apr 4, 2022
Co-authored-by: Per Thomas Lundal <pt@lundal.io>
@lundal lundal closed this as completed Apr 4, 2022
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