diff --git a/tools/isobuild/compiler-plugin.js b/tools/isobuild/compiler-plugin.js index d550fdbe7b2..3055eb697f2 100644 --- a/tools/isobuild/compiler-plugin.js +++ b/tools/isobuild/compiler-plugin.js @@ -14,6 +14,7 @@ import Fiber from 'fibers'; import {sourceMapLength} from '../utils/utils.js'; import {Console} from '../console/console.js'; import ImportScanner from './import-scanner.js'; +import {cssToCommonJS} from "./css-modules.js"; import { isTestFilePath } from './test-files.js'; @@ -482,15 +483,22 @@ class ResourceSlot { // unconditionally as a CSS resource, so that it can be imported // when needed. resource.type = "js"; - resource.data = new Buffer( - 'module.exports = require("meteor/modules").addStyles(' + - JSON.stringify(data) + ');\n', - 'utf8' - ); + resource.data = + new Buffer(cssToCommonJS(data, resource.hash), "utf8"); self.jsOutputResources.push(resource); } else { + // Eager CSS is added unconditionally to a combined