Comments (8)
I experienced the same issue and resolved it by excluding the path for my svg
icons. A snippet of my loaders looks like this:
{
test: /\.svg$/i,
loader: "svg-url-loader",
},
{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "file-loader",
exclude: [path.resolve(__dirname, "src/img")],
},
]
My situation is that I have a folder of svg icons I wanted to load as data URL's, so I could explicitly exclude these from the file loader. Maybe that can provide some additional insight, even if that's not what is going on here...
from svg-url-loader.
Actually, @bentsai already provided a solution. If you use file-loader, it works together with svg-url-loader, resulting in module.exports=
in output bundle.
To avoid all issues, one should exclude svg icons referenced from CSS file from file-loader.
To be 100% sure, I've written 2 test cases, one with file-loader configured to handle both TTF and SVG files, and another one configured to handle only TTF files.
First one failed, because of module.exports=
in the code.
Second one produced correct bundle.
I am closing this issue, as it is caused by wrong webpack configuration and not by bug in svg-url-loader.
from svg-url-loader.
Same here.
Package | Version |
---|---|
webpack | 1.13.2 |
svg-url-loader | 1.1.0 |
from svg-url-loader.
I'll open a PR to fix this but, i don't know if the solution i take is the best but, solved my problem.
from svg-url-loader.
Same issue here versions used match @gabrielrtakeda
from svg-url-loader.
Provided PR fails existing tests, so I think this issue needs more investigation.
Can you please come back with entry file (truncated to the minimum amount of lines required to reproduce the issue) and full webpack config?
from svg-url-loader.
Can you please come back with entry file (truncated to the minimum amount of lines required to reproduce the issue) and full webpack config?
Its provided in the original issue.
from svg-url-loader.
@gajus, do you use css file as a webpack entry?
From the part of webpack config you've provided it is not clear which entries do you have...
from svg-url-loader.
Related Issues (20)
- How to use this in html? HOT 2
- Images svg aren't loading, how to fix? HOT 2
- Incorrectly escapes # in style-element HOT 3
- Question: is there a way to disable plugin inline for few SVG? HOT 1
- Update README to include webpack options configuration for supported parameters HOT 2
- problem with `file-loader` and deps HOT 15
- The benefits of data:xyz style vs. SVG sprites HOT 1
- [Proposal] Add option to skip some phrase during encoding HOT 1
- Issues to find SVGs inside imported sass files. HOT 1
- Please update `file-loader` to latest version HOT 14
- Incorrect Data URI content when using issuer test HOT 2
- Doesn't working on image tag HOT 2
- Missing webpack in peerDependencies for yarn@2 compatibility HOT 1
- Please Add CHANGELOG.md HOT 1
- Action Required: Fix Renovate Configuration
- [Webpack]Error report of introducing SVG file into img tag ? Please refer to the screenshot. HOT 13
- "module export" instead of svg directly HOT 6
- Dependency Dashboard
- Malformed svg produced HOT 3
- Svg is abstracted from css file. HOT 3
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 svg-url-loader.