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

Do not try to parse again the string if it's already parsed #11

Closed
wants to merge 1 commit into from

Conversation

xavimb
Copy link

@xavimb xavimb commented Oct 2, 2015

Fixes #10

@cheshire137
Copy link

Why did this get closed? #13 and #10 are still problems.

@MartinMuzatko
Copy link

Please merge! @sokra

MartinMuzatko added a commit to MartinMuzatko/json-loader that referenced this pull request Feb 15, 2016
@MartinMuzatko MartinMuzatko mentioned this pull request Feb 15, 2016
@jeffreyluo
Copy link

so we can use module.exports to solve this problem ?@MartinMuzatko

@MartinMuzatko
Copy link

AFAIK, the json-loader should just require JSON files.
If you need module.exports I'd recommend using the default module.exports = {} as js file.
Please let me know if I'm wrong @jeffreyluo

@jeffreyluo
Copy link

yeah, I know what you mean, I had meet this problem too.
For the moment, using the module.exports may be the only way? @MartinMuzatko

@MartinMuzatko
Copy link

A proper specification for what use cases the JSON-loader really is for would be great. AFAIK the point of the JSON Loader is to require JSON Files without needing to do a module.exports

@arahansen
Copy link

I'm still having issues with this bug. I'm not sure I understand why this PR isn't being merged. Can @xavimb or @sokra share a bit on the reasoning here?

Also, is there a workaround in the meantime?

@elliotchance
Copy link

I too came across this error. I managed to fix it with this patch (fix is the wrong word, prove that the library is broken is more appropriate).

I'm also left wondering why it wasn't merged in or at least explained?

@mikeerickson
Copy link

+1

@warrenseine
Copy link

I think it's not merged because it's a workaround, as explained by @MartinMuzatko. A fix should be applied either in the calling library (which parses JSON twice) or in the libraries using .json extension for .js files.

The thing is, libraries should just have a .js file that requires the JSON (see mime-db). This way, you can just use a raw-loader and avoid these errors.

@bora89
Copy link

bora89 commented Feb 27, 2017

Guys, I want to use json-loader and file-loader togeter? It causes the same error. I want not only to load json, but also to copy .json files to my pubic dir.

{ test: /\.json$/, loader: 'json-loader' },
{ test: /\.json$/, loader: 'file?name=data/[path][name].[ext]' },

How to be?

@elliotchance
Copy link

@bora89 you should open that as a new issue, otherwise you won't get any attention on a close issue.

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

Successfully merging this pull request may close these issues.

None yet

9 participants