-
-
Notifications
You must be signed in to change notification settings - Fork 711
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usage with webpack #44
Comments
Adding these sections to the // this is required because `gray-matter` uses the `fs` module for some things
node: {
fs: "empty"
}, As the last loader: , {
test: /\.js$/,
loaders: ['unlazy']
} This will work because you've already transformed your scripts through babel, now the unlazy loader will work on anything other javascript that's required through a |
Ah! Thank you @doowb! In addition to the last loader, I added an include regex so unlazy is only applied to the {
test: /\.js$/,
loaders: ['unlazy'],
include: /node_modules\/markdown-toc/
} It didn't help that I have two sets of loaders, dev and prod, and unlazy was only being used by prod. But oh well... Thanks again! |
For those using Create-React-App, this is not really a solution (since we don't have any direct way to modify webpack.config.js). Is there any way this could be fixed properly (without having to touch webpack), and if yes, would you consider re-opening this issue? |
#44 (comment) |
maybe you can use https://www.npmjs.com/package/markdown-toc-unlazy as alternative |
I've had success in the past using this module with webpack. I'm not sure when or which version the change occurred, but this is no longer the case.
I've setup a gist with the bare minimum code showing what I've been doing.
Output from webpack
Output from browser
I have tried
process.env.UNLAZY = true;
as suggested inlazy-loader
This results in a failure to resolve minimist
I have tried doowb/unlazy-loader
Though as I'm using babel on my own source files, I can't use
unlazy-loader
without running babel across all mynode_modules
which takes a long time.I have tried using unlazy in my import statement
This results in just
markdown-toc/index.js
being resolved with unlazy.I understand there are a lot of parties involved here, so I thought I'd start here and hopefully involve others as the need arises.
These were the two related issues I found
jonschlinkert/lazy-cache#3
webpack/webpack#1763
The text was updated successfully, but these errors were encountered: