UNPKG

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