This repository was archived by the owner on Aug 20, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +18
-11
lines changed Expand file tree Collapse file tree 1 file changed +18
-11
lines changed Original file line number Diff line number Diff line change 1- /*
2- MIT License http://www.opensource.org/licenses/mit-license.php
3- Author Tobias Koppers @sokra
4- */
5- module . exports = function ( source ) {
6- var value = typeof source === "string" ? JSON . parse ( source ) : source ;
7- value = JSON . stringify ( value )
8- . replace ( / \u2028 / g, '\\u2028' )
9- . replace ( / \u2029 / g, '\\u2029' ) ;
10- var module = this . version && this . version >= 2 ? `export default ${ value } ;` : `module.exports = ${ value } ;` ;
11- return module ;
1+ module . exports = function ( source ) {
2+ if ( this . cacheable ) this . cacheable ( ) ;
3+
4+ var value = typeof source === "string" ? JSON . parse ( source ) : source ;
5+
6+ value = JSON . stringify ( value )
7+ . replace ( / \u2028 / g, '\\u2028' )
8+ . replace ( / \u2029 / g, '\\u2029' ) ;
9+
10+ if ( this . version && this . version >= 2 ) {
11+ this . emitWarning ( `⚠️ JSON Loader\n
12+ It seems you're using webpack >= v2.0.0, which includes native support for JSON.
13+ Please remove this loader from webpack.config.js as it isn't needed anymore and
14+ is deprecated. See the v1.0.0 -> v2.0.0 migration guide for more information
15+ (https://webpack.js.org/guides/migrating/#json-loader-is-not-required-anymore)\n` )
16+ }
17+
18+ return `module.exports = ${ value } ` ;
1219}
You can’t perform that action at this time.
0 commit comments