Skip to content
Permalink
Browse files

fix: properly support loader option (#549)

  • Loading branch information...
tivac committed Jan 23, 2019
1 parent 0e85fea commit ff38e836d9e5ac2dcda0a469536e9a727bbd30a6
@@ -12,11 +12,11 @@ exports.loader = (options, str) => {
if(i === -1) {
throw new Error("Unable to find strict mode declaration");
}

// + 1 is for the newline...
str.appendRight(
i + search.length + 1,
`import lazyload from "./css.js";\n`
`${options.loader}\n`
);
};

@@ -28,4 +28,4 @@ exports.load = (options, imports, statement) => `
.then((results) => resolve(results[results.length - 1]))
.catch(reject)
`;

@@ -3,9 +3,7 @@ exports.regex = (deps) => new RegExp(
"g"
);

exports.loader = (options, str) => str.prepend(
`import lazyload from "./css.js";\n`
);
exports.loader = (options, str) => str.prepend(`${options.loader}\n`);

exports.load = (options, imports, statement) => `
Promise.all([
@@ -14,4 +12,4 @@ exports.load = (options, imports, statement) => `
])
.then((results) => results[results.length - 1])
`;

@@ -12,11 +12,11 @@ exports.loader = (options, str) => {
if(i === -1) {
throw new Error("Unable to find strict mode declaration");
}

// + 1 is for the newline...
str.appendRight(
i + search.length + 1,
`import lazyload from "./css.js";\n`
`${options.loader}\n`
);
};

@@ -27,4 +27,4 @@ exports.load = (options, imports, statement) => `
])
.then((results) => results[results.length - 1])
`;

0 comments on commit ff38e83

Please sign in to comment.
You can’t perform that action at this time.