fix: load asset content#62
Conversation
cwillisf
left a comment
There was a problem hiding this comment.
I'm OK with these changes but I'm confused about the need since there's no mention of file-loader in webpack.config.js. In the interest of my own learning: is file-loader somehow included in the default Webpack config, and if so is that documented somewhere? (I can't seem to find it...)
|
@cwillisf that's a good question. I believe the rule for loading SVGs with |
|
@ktbee aha! That makes sense. Thanks! |
|
Also here is the relevant Webpack documentation, for anyone that's not familiar with the |
|
🎉 This PR is included in version 1.2.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Resolves
When I tried to use the default SVG asset in scratch-storage's
builtinsfolder, I found that thedataproperty just returned a string that was the file's path and name. This prevented me from getting the file's contents.Proposed Changes
Disable the Webpack
file-loaderloader for theserequirestatements. Webpack will still use the specifiedarraybuffer-loaderloader for these files, but not usingfile-loaderwill givearraybuffer-loaderthe contents of the files rather than a string with the path and name of the file.