Comments (11)
I'm sorry guys, I was very busy with work this year. Gonna check
webpack
,rollup
pretty sonner.
Not true.
from datauri.
Just a recall that PRs are always welcomed in open-source community and behind the scenes we have humans writing codes. Apparently, shamming contributors sounds an easier path though
But yes! I should have prioritized it somehow, and sorry for those waiting for.
Being very transparent, I totally forget about this issue(can I?) and sometime I'll fix/review it.
Cheers!
from datauri.
FWIW, seems there is a shebang-loader that will solve this problem for me within webpack. So the fact that I don't need to write my own loader/code (and others have encountered it with a few different npm modules out there), makes this feel like less of a datauri issue.
But I know there are numerous webpack issues about this, where they keep claiming it's the problem of the module authors, who are making libraries-that-are-also-scripts. (Since technically, # is technically not a valid javascript comment, and these are malformed JS files to include/require in a build setting.)
from datauri.
@mikelambert I'm in the same position you are, trying to get mjml
up and running. How did you bring shebang-loader into your webpack config? Based on the usage, it looks like the loader must be explicitly referenced in the require. Does that mean I need to fork mjml and fix any requires to datauri? Or were you able to simply preface the require to mjml
?
Update for anyone else in my shoes: This shebang-loader
gets the job done, there's a closed issue on its repo which shows how to properly set the webpack config: JavascriptIsMagic/shebang-loader#2 . Note to Windows users like myself, that issue recommends that we use path.resolve()
to match on the offending npm package. That didn't work for me because you need to accurately specify the whole path. It was easier to use a RegEx that accounted for the different line break characters: /node_modules(\/|\\)datauri(\/|\\)index\.js$/
from datauri.
I just checked. I can confirm that it works. Thank you.
from datauri.
Thank you all for reporting this and sorry for my absence last year.
from datauri.
Ah sorry for the delay in responding, just came to respond and saw you figured it out.
Just a heads-up, I was unable to get <mjml-style inline="inline">
working. I forget exactly, but that seems to pull in additional modules (as part of a css selector package, I think?), some of which do not work in a webpack environment since they do require(env.NODENEV === 'production' ? 'prod.js' : 'dev.js')
. And even with a webpack.DEFINE_PLUGIN, webpack was having trouble when attempting to statically analyze that dependency.
Finally just gave up and am currently inlining my CSS in the tags where it's necessary (mainly to override link colors, which didn't work with a <style> tag due to some sort of precedence issues.)
from datauri.
I'm sorry guys, I was very busy with work this year. Gonna check webpack
, rollup
pretty sonner.
from datauri.
@john-osullivan @mikelambert How exactly did you resolve it?
I tried to do it both ways but none ended up working:
module.exports = {
module: {
...
loaders: [
...
{
test: /node_modules(\/|\\)npm(\/|\\)bin(\/|\\)npm-cli\.js$/,
loaders: ['shebang', 'babel']
}
]
}
...
};
and
module.exports = {
module: {
...
rules: [
{
test: path.resolve(String(path.appSrc), 'node_modules/npm/bin/npm-cli.js'),
use: 'shebang-loader',
}
]
}
...
};
I've included these in my webpack.config.prod.js
.
My #! was located in npm-cli.js
.
O'm in "[email protected]
"
from datauri.
What is the status of this issue? It's more that one year old!
from datauri.
v2.0 FINALLY released https://github.com/data-uri/datauri/releases/tag/v2.0.0
Could any of you please recheck if it fixes webpack compatibility?
from datauri.
Related Issues (15)
- [FEATURE] Provide image dimensions in class instance HOT 3
- Cannot find module './old/module' HOT 4
- Encode from stream HOT 1
- -
- datauri 3.0 - RFC 🎉 HOT 4
- offer option to get datauri for string HOT 4
- If we pass a data URI to `new DataURI` - should we simply return it? HOT 2
- undefined is not an object (evaluating 'version.trim') HOT 1
- TypeScript support HOT 9
- Remove first line! No JS comment! Webpack cant read file HOT 3
- M4A Audio is not handled HOT 3
- please change 'getCSS' to 'getCss' HOT 2
- Allow passing a custom template for the CSS HOT 2
- How to pass an array of files and write in the same css file ? HOT 2
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 datauri.