@eyeglass/cli 0.1.8 → 0.2.0
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/index.js +7 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -540,8 +540,8 @@ function setupVite(configFile, dryRun) {
|
|
|
540
540
|
log('Inspector already imported', 'success');
|
|
541
541
|
return true;
|
|
542
542
|
}
|
|
543
|
-
// Add import at the top
|
|
544
|
-
const importStatement = `
|
|
543
|
+
// Add dynamic import at the top (tree-shakeable in production)
|
|
544
|
+
const importStatement = `if (process.env.NODE_ENV !== 'production') {\n import('@eyeglass/inspector');\n}\n`;
|
|
545
545
|
const newContent = importStatement + content;
|
|
546
546
|
if (dryRun) {
|
|
547
547
|
log(`Would add inspector import to ${path.relative(cwd, entryFile)}`);
|
|
@@ -675,8 +675,8 @@ function setupNextPagesRouter(cwd, dryRun) {
|
|
|
675
675
|
log('Inspector already imported in ' + path.basename(targetFile), 'success');
|
|
676
676
|
return true;
|
|
677
677
|
}
|
|
678
|
-
// Add import at the top
|
|
679
|
-
const importStatement = `
|
|
678
|
+
// Add dynamic import at the top (tree-shakeable in production)
|
|
679
|
+
const importStatement = `if (process.env.NODE_ENV !== 'production') {\n import('@eyeglass/inspector');\n}\n`;
|
|
680
680
|
const newContent = importStatement + fileContent;
|
|
681
681
|
if (dryRun) {
|
|
682
682
|
log(`Would add inspector import to ${path.relative(cwd, targetFile)}`);
|
|
@@ -718,8 +718,8 @@ function setupCRA(entryFile, dryRun) {
|
|
|
718
718
|
log('Inspector already imported', 'success');
|
|
719
719
|
return true;
|
|
720
720
|
}
|
|
721
|
-
// Add import at the top
|
|
722
|
-
const importStatement = `
|
|
721
|
+
// Add dynamic import at the top (tree-shakeable in production)
|
|
722
|
+
const importStatement = `if (process.env.NODE_ENV !== 'production') {\n import('@eyeglass/inspector');\n}\n`;
|
|
723
723
|
const newContent = importStatement + content;
|
|
724
724
|
if (dryRun) {
|
|
725
725
|
log(`Would add inspector import to ${path.relative(cwd, entryFile)}`);
|
|
@@ -810,7 +810,7 @@ async function init(options) {
|
|
|
810
810
|
log('Inspector already imported', 'success');
|
|
811
811
|
}
|
|
812
812
|
else {
|
|
813
|
-
const importStatement = `
|
|
813
|
+
const importStatement = `if (process.env.NODE_ENV !== 'production') {\n import('@eyeglass/inspector');\n}\n`;
|
|
814
814
|
const newContent = importStatement + content;
|
|
815
815
|
if (dryRun) {
|
|
816
816
|
log(`Would add inspector import to ${path.relative(process.cwd(), entryFromHtml)}`);
|