Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
feat(nuxt-module): add CHOKIDAR_USEPOLLING flag for development (#1322)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkucmus authored Feb 8, 2021
1 parent f8f354c commit 293cf0f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/cli/src/extensions/nuxt-extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,28 @@ module.exports = (toolbox: GluegunToolbox) => {
await toolbox.patching.append(".gitignore", "/static");
}

// Add chokidar flag
const configChokidarFlag = await toolbox.patching.exists(
"nuxt.config.js",
`CHOKIDAR_USEPOLLING`
);
if (!configChokidarFlag) {
const configEnvSection = await toolbox.patching.exists(
"nuxt.config.js",
"env:"
);
await toolbox.patching.patch("nuxt.config.js", {
insert: !configEnvSection
? `
env: {
CHOKIDAR_USEPOLLING: process.env.NODE_ENV == "production" ? 0 : 1,
},`
: `
CHOKIDAR_USEPOLLING: process.env.NODE_ENV == "production" ? 0 : 1,`,
after: !configEnvSection ? "export default {" : "env: {",
});
}

// Add telemetry flag
const configTelemetryFlag = await toolbox.patching.exists(
"nuxt.config.js",
Expand Down

0 comments on commit 293cf0f

Please sign in to comment.