Code Monkey home page Code Monkey logo

Comments (5)

Rush avatar Rush commented on June 14, 2024 1

Awesome! THe workaround for not using variables in the require expression is simply to prepare utility data structures. Such as:

- const statusIcons = { draft: require('images/status/draft.png'), reject: require('images/status/reject.png'), review: require('images/status/review.png'), approve: require('images/status/review.png') };

from pug-loader.

Rush avatar Rush commented on June 14, 2024

Thanks for adding it to the "in development" milestone. :) I hope I will not have to wait for long as I'm slightly blocked, but not too worry too much :)

from pug-loader.

webdiscus avatar webdiscus commented on June 14, 2024

hallo @Rush

thank you for very important issue. I have enhanced the resolving of alias for array.

You can see possible usage cases in the fixture and resolve.alias for compile method.

⚠️ Limitation for compile method and alias as an array

Usage of a variable in request don't work if alias is an array:

resolve: {
  alias: {
     Images: ['/path_1/', '/path_2/'],     
  }
}
- var basename = 'logo';
img(src=require('Images/' + basename + '-c1.jpeg')) <-- does not work

img(src=require('Images/logo.jpeg')) <-- works

This is limitation of webpack compiler self, webpack don't recognize an asset request contained a variable. But the webpack resolver resolve this assets correct. This limitation does not affect the render and html methods.

New version is 1.7.1

from pug-loader.

webdiscus avatar webdiscus commented on June 14, 2024

Awesome! The workaround for not using variables in the require expression is simply to prepare utility data structures. Such as:

- const statusIcons = { draft: require('images/status/draft.png'), reject: require('images/status/reject.png'), review: require('images/status/review.png'), approve: require('images/status/review.png') };

Thanks, it works too :-)

from pug-loader.

Rush avatar Rush commented on June 14, 2024

Fixed, works great now. Thank you!

from pug-loader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.