require('nunjucks') within webpack returns an empty object
See original GitHub issueWhen requiring nunjucks within a webpack project, an empty object is returned instead of nunjucks.
eg.
// webpack.config.js
module.exports = {
entry: './main.js'
};
// main.js
var nunjucks = require('nunjucks');
console.log(nunjucks); // outputs {}
Issue Analytics
- State:
- Created 8 years ago
- Comments:31 (20 by maintainers)
Top Results From Across the Web
Why webpack returns an empty object when requiring its output?
In case you build a library for others to use from node_modules, you need to tell webpack that you want to support umd...
Read more >Nunjucks API
API. The API for nunjucks covers rendering templates, adding filters and extensions, customizing template loading, and more.
Read more >SETUP SIMPLE WEBSITE USING NODE.JS, EXPRESS ...
Let's install the required dependencies using the following commands. Install Node & npm from nodejs.org. or you can directly install it using brew ......
Read more >How to Set Up Nunjucks with ExpressJS - DEV Community
First, create an empty folder. Navigate into the folder and run the following command to initialise npm: npm init.
Read more >email-templates - npm
Start using email-templates in your project by running `npm i ... pass an i18n configuration object as config.i18n (or an empty one as...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Gotcha. Removing chokidar seems like a solid idea!
Thanks for merging this for now, and also for your help maintain this awesome library. It is so slick in so many ways!
@carljm i think it should be documented, because it also seems to be doing the same thing with browserify. Anyone coming to nunjucks for the 1st time doesn’t expect this resolution as the default just my $0.02.
to do it within browserify you need to shim it like webpack using browserify-shim transform.
adding something like this to package.json: