Skip to content
This repository was archived by the owner on Aug 20, 2018. It is now read-only.

Alternative installation method #12

Closed
Reggino opened this issue Nov 27, 2015 · 3 comments
Closed

Alternative installation method #12

Reggino opened this issue Nov 27, 2015 · 3 comments

Comments

@Reggino
Copy link

Reggino commented Nov 27, 2015

Thank you for this!

Since node 5 it is possible to just require .json files (see discussion e.g. webpack/webpack#184 and https://github.com/nodejs/node-v0.x-archive/blob/master/lib/module.js#L485 )

To reflect that, it would be nice if the README.md could point out that the same syntax (require('sample.json')) can be used, using this loader by adding

  module: {
    loaders: [
    {
      test: /\.json$/,
      loader: 'json'
    }]
  }

to your Webpack configuration file. It took me a while to figure that out while require-ing node 5 modules.

@IngwiePhoenix
Copy link

Small correction here:

Node’s native JSON loading was possible even within 0.10.x releases.

@SpaceK33z
Copy link
Contributor

PR welcome. Note that this is also somewhat related to #7.

@SpaceK33z
Copy link
Contributor

Closing since to use json in webpack, you still need json-loader.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants