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