You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mohemmionic5/Mohem/node_modules_/raw-loader/index.js

21 lines
528 B
JavaScript

/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
const { getOptions } = require('loader-utils');
const validateOptions = require('schema-utils');
const schema = require('./options');
module.exports = function rawLoader(source) {
const options = getOptions(this) || {};
validateOptions(schema, options, 'Raw Loader');
const json = JSON.stringify(source)
.replace(/\u2028/g, '\\u2028')
.replace(/\u2029/g, '\\u2029');
return `module.exports = ${json}`;
};