Skip to content

Fixes initial, clean build in projects using this loader #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

Idorobots
Copy link

@Idorobots Idorobots commented Oct 14, 2016

Because of how Webpack works, files created while typed-css-modules-loader executes aren't immediately visible to ts-loader what usually ends with a 'missing module' error the first time a project is built.
The standard solution is just to rerun the build, but that's not really suitable for CI in larger projects, so here's my proposed solution - it just creates a dummy file withing Webpacks memory FS along the actual one, so Webpack can forward its filename to ts-loader and then to tsc which, in turn, will access the actual file on the OS FS. 😃

Here's a seed project, where I'm using a similar hack. I've also tested the same project with a patched local version of typed-css-modules-loader and it seems to work fine.

@mohsen1
Copy link
Contributor

mohsen1 commented Oct 27, 2016

@Idorobots Are you sure this is working? I could not make it work on my setup.

@Idorobots
Copy link
Author

@mohsen1 I've tested it on a fresh clone of the seed project and you are totally right, it still reports an error during build:

(4,25): error TS2307: Cannot find module './navbar.css'.

However, the build continues, tests pass and the built app starts, so I must've missed it when I was testing it for this PR. I'll close it for now and see if I can find an actual fix. Thanks for pointing this out.

@Idorobots Idorobots closed this Oct 27, 2016
@mohsen1
Copy link
Contributor

mohsen1 commented Oct 27, 2016

Thanks for letting me know. I'll dig into this soon. It shouldn't be impossible to tell Webpack those files exist.

@muuki88
Copy link
Contributor

muuki88 commented Apr 5, 2017

Hi folks. Has anyone made any progress on this? I haven't found anything on how
to tell webpack dependencies between loaders.

tgroutars pushed a commit to producthunt/typed-css-modules-loader that referenced this pull request May 2, 2019
Move css-loader to peerDependencies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants