GithubHelp home page GithubHelp logo

Comments (12)

VitaliyR avatar VitaliyR commented on May 28, 2024 3

It's better to update the README about this functionality :)

from raw-loader.

alexander-akait avatar alexander-akait commented on May 28, 2024 2

https://github.com/webpack-contrib/raw-loader/releases/tag/v2.0.0

Use default

from raw-loader.

ir-fuel avatar ir-fuel commented on May 28, 2024 2

Sure it is technically possible. It's just more code to write as I have to import everything first and then insert it in the object.

from raw-loader.

ir-fuel avatar ir-fuel commented on May 28, 2024

Downgrading to 1.0.0 solves the issue

from raw-loader.

ir-fuel avatar ir-fuel commented on May 28, 2024

What do you mean by "use Default" ?

from raw-loader.

alexander-akait avatar alexander-akait commented on May 28, 2024

@ir-fuel require('something').default or rewrite your code base on import, it is first releases for better supporting import, without this breaking change we never migrate on ES modules

from raw-loader.

ir-fuel avatar ir-fuel commented on May 28, 2024

Adding .default has indeed solved it.
I'm filling an object with a bunch of external file contents.

const vertexShaders = {
  pbr: require('../../../shader/pbr.glslv').default,
  outline: require('../../../shader/outline.glslv').default,
  outline_mask: require('../../../shader/outline_mask.glslv').default,
  background: require('../../../shader/background.glslv').default
}

This is afaik not something that can be done using import statements

from raw-loader.

alexander-akait avatar alexander-akait commented on May 28, 2024

@ir-fuel all can be done using import, just move all require on top and change this to import, because it is doesn't has sense in your example

from raw-loader.

alexander-akait avatar alexander-akait commented on May 28, 2024

@ir-fuel anyway if you have idea how we can handle ES and require PR welcome

from raw-loader.

alexander-akait avatar alexander-akait commented on May 28, 2024

Maybe exports.default = module.exports = value, need add test for this to check tree shaking

from raw-loader.

alexander-akait avatar alexander-akait commented on May 28, 2024

exports.default = module.exports break tree shaking, so better use .default for require

from raw-loader.

runfaj avatar runfaj commented on May 28, 2024

It's better to update the README about this functionality :)

This is an es6 transpiling thing via babel - it doesn't really have to do with raw-loader. It is documented in babel's documentation. If people are having the issue though, finding this issue (like I did) via a search engine works well enough.

from raw-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.