Comments (11)
Hello @XenoBino ,
Good news, I've taken the time to improve the alias resolving.
I already have positive results. Soon I release next version with support of resolve.plugins
.
from pug-loader.
Hello @XenoBino,
thank you for the bug report!
I will try reproduce it by me local.
from pug-loader.
Hello @XenoBino
- you has the error in
views/index.pug
by alias@component/
, is missed thes
at end. Please edit your message.
include @component/nav
==>include @components/nav
- current this plugin support only
resolve.alias
- the temporary solution your problem is usage
resolve.alias
:resolve: { //plugins: [tsConfig], // this is not supported alias: { '@components': helpers.src('components'), // this works }, },
from pug-loader.
Hi @webdiscus,
Thank you for taking time to review and fix the issue.
I am about to meet a deadline in a project I am working on, and the paths
/resolve.alias
issues was really frustrating and time consuming to deal with, so I really appreciate all the effort spent in solving this issue.
In reply to 3 in your second comment, I tried using resolve.alias
as a substitute to paths
in my project, but it seems that the typescript loader, @ngtools/webpack
, doesn't honor aliases defined their. In my free time I tested @ngtools/webpack
with resolve.alias
in an empty project, and strangely it worked. I might also open an issue in @ngtools/webpack
about this.
Generally, I suggest not to use resolve.alias
with typescript, since IDEs and editors will not understand imports.
from pug-loader.
Hello @XenoBino,
I have added support for resolve.plugins
. Currently it works only for extends
and include
, not for require()
, because for it used the complex Interpolation
. To resolve embedded resources via require()
use alias.
The very fast resolve.alias
will be used first, if nothing is resolved then the slow webpack resolver will be used.
Warning: using a resolver other than resolve.alias can seriously degrade performance.
Please try the new NPM package ^1.6.2
.
Here is the test case for resolve.plugins .
from pug-loader.
Hello @XenoBino,
can you please test new fixed version 1.6.2
and if all is ok than close this issue?
from pug-loader.
Hello @webdiscus,
My apologies for the late reply, I have been busy the past month.
After 1.6.0-alpha1
, the loader began to have issues with hot module replacement which might mean that files are not being added to the dependency tree thus not watched. I have updated to 1.7.1
and the issue continued. I might rollback to 1.5.*
till this feature is stable.
Additionally I suggest adding an option to enable (making it disabled by default) the behavior added after this issue as it slows the build process. Also I believe that it is uncommon for a developer to have the same case described above.
from pug-loader.
Hello @XenoBino,
possible that the problem with watching of dependencies has a relation with the issue path errors on Windows. This issue was fixed in new version 1.7.3
.
Note: by webpack serv
the live reload of browser after rebuild is not supported.
from pug-loader.
The new resolver in pug-loader firstly try to resolve an alias from resolve.alias
(this is fastest method), then if alias not resolved try to resolve with slow enhanced-resolver
to resolve from resolve.plugins
.
Tips
To speed up the build process should be used resolve.alias
only. Each item in alias should be a string. If alias is array of paths, will be used slow enhanced-resolver.
from pug-loader.
Hello, @webdiscus.
I ran a few tests and everything seems to be working correctly after I upgraded to 1.7.3
.
Build time became 81s (2.5s or less incremental) on my mid tier device.
Thanks for taking time to solve these issues.
from pug-loader.
Hello @XenoBino,
thanks for the feedback :-)
from pug-loader.
Related Issues (20)
- Failed to build when webpack alias for asset is an array of paths instead of a single path HOT 5
- [CRITICAL] [SECURITY] Pug variables leak between different executions of rendered templates HOT 10
- Path errors on Windows? HOT 6
- How to use it with tailwindcss and server side rendering? HOT 13
- [Bug] Pug error in dependency requires restart of webpack HOT 9
- Support resolving modules HOT 1
- Compile error on bad JS Syntax is confusing HOT 3
- Support Webpack defined modules HOT 4
- Missing peer dependency pug-walk HOT 3
- Cannot read properties of undefined (reading 'sync') in @webdiscus\pug-loader\src\Resolver.js HOT 2
- Vue production build errors in example HOT 6
- hello-world-app does not compile HOT 3
- webpack-dev-server: pages require access with .html HOT 7
- Doesn't fix indent pug with @webdiscus/pug-loader on nuxt 3 (vite) HOT 3
- Will this support pug3? HOT 2
- Improve the error message to find where the error occurred HOT 2
- img srcset attribute HOT 3
- htmlWebpackPlugin.options not available in pug template HOT 10
- Errors don't show the exact location of the error HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pug-loader.