1 | import { getOptions } from 'loader-utils';
|
2 | import validateOptions from 'schema-utils';
|
3 | import schema from './options.json';
|
4 |
|
5 | export const raw = true;
|
6 |
|
7 | export 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 | }
|