4 ms·
In your `webpack.config.js`: module: { loaders: [ { test: /\.json$/, loader: 'json' }, ] } Elsewhere: var version = require('
by grayrest 12y ago
In your `webpack.config.js`:
module: {
loaders: [
{ test: /\.json$/, loader: 'json' },
]
}
Elsewhere:
var version = require('./package.json').version;
Loaders are common.js packages that export a single function and expect `this` to have the loader API. You can put them as dependencies in your `package.json`. You can wire them up in your config. It's not any less flexible than browserify.
- mattdesl 12y agoThe issue is twofold: - It shows Node compatibility is not a primary concern of Webpack. - It is not a default feature of Webpack. Pretty much every Webpack project will need to include this loader config if you want to (safely) start consuming Node/browserify modules I added the config to the article to detail the additional steps.