0

I have a monorepo project which one project (main) depends on the other (components). So when I start the whole monorepo the main project uses a webpack.dev and the components project just use simple typescript compiler. Like this:

(main): yarn start: webpack-dev-server ...

(components): yarn start: tsc -b

I have no problem when it comes to only TS code, but when it comes to non-ts files (css) I get a webpack module missing error.

I've already put both css-loader and style-loader into my webpack config from my main project but it didn't seem to solve the problem, it looks like typescript is not compiling the css file correctly

in my component project I have some like this:

import "./index.css"

export const Button = () => {
...
}

and then I get this error from my main project

Module not found: Error: Can't resolve './index.css' in '{...}/frontend/design-components/build'

my webpack in my main project:

 module: {
    rules: [
      ...,
      {
        test: /\.css$/i,
        use: ['style-loader', 'css-loader'],
      },
    ],

but I think the main problem is the way the components project is handling the build (i'm building only with typescript, no rollup nor webpack in this project)

1 Answer 1

1

just ended up creating a webpack for my component project as well

Sign up to request clarification or add additional context in comments.

2 Comments

Will you share it please!
Hi, so it was pretty simple I just created a webpack in my component projects with the necessary rules to "compile" css/scss

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.