Comments (9)
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.
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.
Sure, I can add that 👍🏻
from raw-loader.
Thank you - I will be phasing out my usage of them then.
from raw-loader.
You can track assert
here webpack/webpack#11917
from raw-loader.
@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.
ES modules compatibility + the same approach without extra configurations
from raw-loader.
@alexander-akait thank you for this! Good stuff!
from raw-loader.
@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)
- raw-loader returns export string instead of file content HOT 1
- Export incompatibility with raw-loader and awesome-typescript-loader HOT 3
- The variable contains the path to the file instead of the text HOT 4
- Cannot import file using typescript HOT 6
- Imported string contains module.exports HOT 4
- Module parse failed: Unexpected token m in JSON at position 0 while parsing near 'module.exports = "{\...' HOT 5
- raw-loader 2.0 not working with pug-html-loader HOT 8
- Not working with require statements HOT 12
- Warning/Failure Using Raw Loader 2.0.0 in Angular CLI HOT 4
- error when using with SCSS and angular7 HOT 6
- Angular and Styles HOT 2
- The template specified for component AppComponent is not a string HOT 3
- version 2.0.0 breaks ng Angular 8 -> webpack in my project HOT 5
- You may need an appropriate loader to handle this file type. HOT 3
- [Bug Report] raw-loader failed to load *.json HOT 2
- Can raw-loader catch all HOT 3
- `Module not found` when using TypeScript project references HOT 2
- Module Not Found HOT 1
- Watch not working HOT 9
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 raw-loader.