diff --git a/README.md b/README.md index 3830420c2..da031f8ed 100644 --- a/README.md +++ b/README.md @@ -167,7 +167,7 @@ module.exports = { } ``` -For a full breakdown of the power of query syntax have a read of [this](https://github.com/webpack/loader-utils#parsequery). +For a full breakdown of the power of query syntax have a read of [this](https://github.com/webpack/loader-utils#getoptions). #### Available Options diff --git a/package.json b/package.json index 02fb45a6c..829f0c6ac 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "dependencies": { "colors": "^1.0.3", "enhanced-resolve": "^3.0.0", - "loader-utils": "^0.2.6", + "loader-utils": "^1.0.2", "semver": "^5.0.1" }, "devDependencies": { diff --git a/src/index.ts b/src/index.ts index 84861ca6c..82779461a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,7 +19,6 @@ function loader(this: interfaces.Webpack, contents: string) { this.cacheable && this.cacheable(); const callback = this.async(); const options = getLoaderOptions(this); - const { instance, error } = instances.getTypeScriptInstance(options, this); if (error) { @@ -63,7 +62,7 @@ function getLoaderOptions(loader: interfaces.Webpack) { webpackIndex = webpackInstances.push(loader._compiler) - 1; } - const queryOptions = loaderUtils.parseQuery(loader.query); + const queryOptions = loaderUtils.getOptions(loader) || {} as interfaces.LoaderOptions; const configFileOptions: PartialLoaderOptions = loader.options.ts || {}; const instanceName = webpackIndex + '_' + (queryOptions.instance || configFileOptions.instance || 'default'); diff --git a/src/typings/loaderUtils/loaderUtils.d.ts b/src/typings/loaderUtils/loaderUtils.d.ts index 599794b99..f5605a290 100644 --- a/src/typings/loaderUtils/loaderUtils.d.ts +++ b/src/typings/loaderUtils/loaderUtils.d.ts @@ -1,5 +1,5 @@ declare module 'loader-utils' { - export function parseQuery(query: string): T; + export function getOptions(loaderContext: { query: string; }): T; export function getRemainingRequest(loaderContext: any): any; export function getCurrentRequest(loaderContext: any): any; } \ No newline at end of file