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

Support resolving modules #15

Closed
m10 opened this issue May 11, 2022 · 1 comment
Closed

Support resolving modules #15

m10 opened this issue May 11, 2022 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@m10
Copy link

m10 commented May 11, 2022

Requiring any modules defined in webpack configuration under resolve.modules does not seem to work currently. This also affects any npm modules under node_modules

Pug:
- const classnames = require('classnames');

Error:

ERROR in   Error: Child compilation failed:
  Module build failed (from ./node_modules/@webdiscus/pug-loader/src/index.js):
  NonErrorEmittedError: (Emitted value instead of an instance of Error)
  [pug-loader] Pug compilation failed.
  PugLoaderException:
  [pug-loader] the file 'classnames' can't be resolved in the pug template:
  /path/to/project/pug/file.pug
  Error: Can't resolve 'classnames' in '/path/to/project/pug/'
      at processResult (/path/to/project/node_modules/webpack/lib/NormalModule.js:755:12)
      at /path/to/project/node_modules/webpack/lib/NormalModule.js:860:5
      at /path/to/project/node_modules/loader-runner/lib/LoaderRunner.js:400:11
      at /path/to/project/node_modules/loader-runner/lib/LoaderRunner.js:252:18
      at context.callback (/path/to/project/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
      at /path/to/project/node_modules/@webdiscus/pug-loader/src/index.js:217:21
      at Object.compile (/path/to/project/node_modules/@webdiscus/pug-loader/src/index.js:168:5)
      at Object.module.exports (/path/to/project/node_modules/@webdiscus/pug-loader/src/index.js:216:11)
  ModuleBuildError: Module build failed (from ./node_modules/@webdiscus/pug-loader/src/index.js): 
@webdiscus webdiscus added the enhancement New feature or request label May 11, 2022
@webdiscus webdiscus modified the milestones: in development, testing May 11, 2022
@webdiscus
Copy link
Owner

webdiscus commented May 11, 2022

@m10 Thank you for the report.

Resolving of modules under node_modules was intentionally disabled to increase performance when used huge amount of required resources (e.g. images, icons) and because using of a npm module directly in pug template is very very rare case.

Now I activated revolving under node_modules too.

Fixed version is 2.1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants