Simple Example with raw-loader
See original GitHub issueCan you please provide the most simple example to use raw-loader
for .frag
files using craco ?
Thanks
here is my non working test:
/* craco.config.js */
module.exports = {
webpack: {
alias: {},
plugins: [],
mode: 'extends',
configure: {
module: {
rules: [
{
test: /\.frag$/,
use: 'raw-loader'
}
]
},
}
},
}
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:10 (3 by maintainers)
Top Results From Across the Web
raw-loader - webpack - JS.ORG
A loader for webpack that allows importing files as a String. Getting Started. To begin, you'll need to install raw-loader : $ npm...
Read more >raw-loader examples - CodeSandbox
Learn how to use raw-loader by viewing and forking example apps that make use of raw-loader on CodeSandbox. ... p5.js-web-editorThe web editor for...
Read more >webpack-contrib/raw-loader - GitHub
A loader for webpack that allows importing files as a String. Getting Started. To begin, you'll need to install raw-loader : $ npm...
Read more >raw-loader - webpack
A loader for webpack that allows importing files as a String. Getting Started. To begin, you'll need to install raw-loader : $ npm...
Read more >raw-loader - npm
A loader for webpack that allows importing files as a String. Latest version: 4.0.2, last published: 2 years ago. Start using raw-loader in ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It was easier than expected!!
Raw Loader for Craco:
Use example
here to detect
.frag
files:Hi @melMass
The problem is that your rule is added after the
file-loader
which is CRA fallback for every resources that are not handled by any other specific loader.Here’s a comment from CRA webpack config:
The solution is to add your loader before the
file-loader
.You can do this 2 ways with the help of
craco
utility function addBeforeLoader:1- By using the function override of configure:
2- Or by creating a craco plugin for raw-loader (which I think is the best way 😃). Something like
craco-plugin-add-raw-loader
with plugin options:How to a craco develop-a-plugin
Hope it helps!
Patrick