react-client 1.0.15 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/commands/dev.js +5 -0
- package/package.json +1 -1
package/dist/cli/commands/dev.js
CHANGED
|
@@ -174,6 +174,11 @@ async function dev() {
|
|
|
174
174
|
return res.end(transformCache.get(filePath));
|
|
175
175
|
}
|
|
176
176
|
let code = await fs_extra_1.default.readFile(filePath, 'utf8');
|
|
177
|
+
// 🧩 Rewrite bare imports (react, react-dom, etc.) to /@modules/*
|
|
178
|
+
code = code
|
|
179
|
+
.replace(/\bfrom\s+['"]([^'".\/][^'"]*)['"]/g, (_match, dep) => `from "/@modules/${dep}"`)
|
|
180
|
+
.replace(/\bimport\(['"]([^'".\/][^'"]*)['"]\)/g, (_match, dep) => `import("/@modules/${dep}")`);
|
|
181
|
+
// Run plugin transforms
|
|
177
182
|
for (const p of plugins) {
|
|
178
183
|
if (p.onTransform)
|
|
179
184
|
code = await p.onTransform(code, filePath);
|