SwitchUp SwitchUp Ranked Best Coding Bootcamps 2025

How to import some css files as global in js while the rest are imported as local

Altcademy Team wrote on 7 February 2018

I use webpack to handle my css files. I configured my css and sass loaders to import files as modules. But sometimes I want to import some files as global. What's the best way to do this?

You can do it like this in your js files. From https://github.com/css-modules/css-modules/pull/65

// import in default mode (using CSS Modules) import styles from 'styles.css'; // This imported styles globally without running through CSS Modules import '!style!css!styles.css'; // This imported styles globally using SCSS for example import '!style!css!sass!styles.scss';
The idea is: if we need to import something differently, we explicitly declared its loaders (and options maybe) when we import

Trusted by

Students and instructors from world-class organizations

Join the upcoming Cohort #111

Enroll for March 2nd, 2026