Skip to content
This repository has been archived by the owner on Oct 30, 2020. It is now read-only.

Using tsconfig-paths I am getting a TypeError: query.substr is not a function #69

Open
ghost opened this issue Jul 28, 2018 · 0 comments

Comments

@ghost
Copy link

ghost commented Jul 28, 2018

I am using a TypeScript-powered Webpack configuration file and in order to use path aliases defined in my tsconfig.json I rely on using tsconfig-paths. Unfortunately TypeScript configuration files for Webpack happen to behave rather erratic and the described method in the documentation does not work at all. Therefore I had to bootstrap my configuration file and add require("tsconfig-paths").register(); as the very first line in my configuration file which fixes issues regarding module resolution.

Unfortunately typings-for-css-modules-loader runs into issues with that bootstrap command enabled and yields the following error:

ERROR in ./Source/Styles.scss (./node_modules/typings-for-css-modules-loader/lib??ref--5-1!./node_modules/sass-loader/lib/loader.js!./Source/Styles.scss)
Module build failed (from ./node_modules/typings-for-css-modules-loader/lib/index.js):
TypeError: query.substr is not a function
    at Object.parseQuery (D:\Source\electron-typescript-boilerplate\node_modules\loader-utils\lib\parseQuery.js:12:11)
    at Object.module.exports (D:\Source\electron-typescript-boilerplate\node_modules\typings-for-css-modules-loader\lib\index.js:54:37)
 @ ./Source/Styles.scss 2:14-152 21:1-42:3 22:19-157
 @ ./Source/App.tsx
 @ ./Source/Index.tsx
 @ multi (webpack)-dev-server/client?http://localhost:3000 (webpack)/hot/dev-server.js webpack-dev-server/client?http://localhost:3000 webpack/hot/only-dev-server ./Source/Index.tsx

The loader configuration looks as follows:

{
    test: /\.scss$/,
    use: [
        { loader: "style-loader" },
        {
            loader: "typings-for-css-modules-loader",
            options: {
                modules: true,
                namedExport: true,
                camelCase: true,
                localIdentName: "[folder]-[local]-[hash:base64:8]",
                banner: [...constants.copyrightHeaderLines, ...constants.generatedHeaderLines].join("\n"),
            },
        },
        { loader: "sass-loader" },
    ],
}

Is there any way to help you figure out where this error comes from?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants