Comments (12)
It's better to update the README about this functionality :)
from raw-loader.
https://github.com/webpack-contrib/raw-loader/releases/tag/v2.0.0
Use default
from raw-loader.
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.
Downgrading to 1.0.0 solves the issue
from raw-loader.
What do you mean by "use Default" ?
from raw-loader.
@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.
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.
@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.
@ir-fuel anyway if you have idea how we can handle ES
and require
PR welcome
from raw-loader.
Maybe exports.default = module.exports = value
, need add test for this to check tree shaking
from raw-loader.
exports.default = module.exports
break tree shaking, so better use .default
for require
from raw-loader.
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)
- [question] how to use the new asset modules with inline requires like you could with raw loader HOT 9
- 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
- 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.