GithubHelp home page GithubHelp logo

Comments (9)

alexander-akait avatar alexander-akait commented on June 21, 2024 1

No docs, because we want to be as close as possible to browser and Node.js ESM spec, and inline syntax is never work in browsers or Node.js, it will be possible in future with assert imports, but now we don't want to create new non ESM syntax, so please use webpack.config.js, sorry, in long term inline syntax should be fully removed, because it was a big mistake

from raw-loader.

alexander-akait avatar alexander-akait commented on June 21, 2024 1

I hope we can introduce new ES modules features in near future and will be fully compatibility with Node.js/browsers/etc targets

from raw-loader.

spence-s avatar spence-s commented on June 21, 2024 1

Sure, I can add that 👍🏻

from raw-loader.

spence-s avatar spence-s commented on June 21, 2024

Thank you - I will be phasing out my usage of them then.

from raw-loader.

alexander-akait avatar alexander-akait commented on June 21, 2024

You can track assert here webpack/webpack#11917

from raw-loader.

alexander-akait avatar alexander-akait commented on June 21, 2024

@spence-s Anyway I think I found solution:

import txt from './file.txt?raw';

and put in webpack.config.js:

{
  // Maybe test need provided too
  type: "asset/source",
  resourceQuery: /raw/
}

Should work

from raw-loader.

alexander-akait avatar alexander-akait commented on June 21, 2024

ES modules compatibility + the same approach without extra configurations

from raw-loader.

spence-s avatar spence-s commented on June 21, 2024

@alexander-akait thank you for this! Good stuff!

from raw-loader.

alexander-akait avatar alexander-akait commented on June 21, 2024

@spence-s I think we need docs it https://webpack.js.org/guides/asset-modules/ , do you want to help?

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.