Skip to content

Commit

Permalink
Restore proxy SSR rewriting for CSS Modules proxy (FredKSchott#3191)
Browse files Browse the repository at this point in the history
  • Loading branch information
drwpow authored Apr 20, 2021
1 parent 5e5d59f commit 8f04439
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions snowpack/src/ssr-loader/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,15 @@ export function transform(data) {
: get_import_name();

const source = node.source.value;

if (source.endsWith('.module.css.proxy.js')) {
// CSS Modules: include both CSS and JS
const cssSource = source.replace(/\.proxy\.js$/, '');
css.push(cssSource);
deps.push({name, source});
} else if (source.endsWith('.css.proxy.js')) {
if (source.endsWith('.css.proxy.js') && !source.endsWith('.module.css.proxy.js')) {
// CSS proxy: only include CSS
css.push(source.replace(/\.proxy\.js$/, ''));
} else {
// everything else: mark as a dep
if (source.endsWith('.module.css.proxy.js')) {
// CSS Modules Proxy: include both CSS and JS
const cssSource = source.replace(/\.proxy\.js$/, '');
css.push(cssSource);
}
deps.push({name, source});

if (!is_namespace) {
Expand Down

0 comments on commit 8f04439

Please sign in to comment.