UNPKG

520 BJavaScriptView Raw
1import { getOptions } from 'loader-utils';
2import validateOptions from 'schema-utils';
3import schema from './options.json';
4
5export const raw = true;
6
7export default function loader(source) {
8 const { version, webpack } = this;
9
10 const options = getOptions(this) || {};
11
12 validateOptions(schema, options, 'Loader');
13
14 const newSource = `
15 /**
16 * Loader API Version: ${version}
17 * Is this in "webpack mode": ${webpack}
18 */
19 /**
20 * Original Source From Loader
21 */
22 ${source}`;
23
24 return `${newSource}`;
25}