Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug/issue 1263 disable livereload background image loading behavior #1264

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions packages/cli/src/plugins/server/plugin-livereload.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class LiveReloadServer extends ServerInterface {
}

async start() {
const { userWorkspace } = this.compilation.context;
const { userWorkspace, projectDirectory } = this.compilation.context;
const standardPluginsDirectoryPath = new URL('../resource/', import.meta.url);
const standardPluginsNames = (await fs.readdir(standardPluginsDirectoryPath))
.filter(filename => filename.indexOf('plugin-standard') === 0);
Expand All @@ -34,18 +34,21 @@ class LiveReloadServer extends ServerInterface {
...customPluginsExtensions,
...this.compilation.config.devServer.extensions
]
.filter((ext) => ext !== '*' || ext !== '')
.map((ext) => ext.replace('.', ''));
.filter((ext) => ext !== '*' || ext !== '') // basic filter for false positives
.filter((ext, idx, array) => array.indexOf(ext) === idx) // dedupe
.map((ext) => ext.startsWith('.') ? ext.replace('.', '') : ext); // trim . from all entries

const liveReloadServer = livereload.createServer({
exts: allExtensions.filter((ext, idx) => idx === allExtensions.indexOf(ext)),
applyCSSLive: false // https://github.com/napcs/node-livereload/issues/33#issuecomment-693707006
});
exts: allExtensions,
applyCSSLive: false, // https://github.com/napcs/node-livereload/issues/33#issuecomment-693707006
applyImgLive: false // https://github.com/ProjectEvergreen/greenwood/issues/1263
}, () => {
const abridgedWorkspacePath = userWorkspace.pathname.replace(projectDirectory.pathname, '').replace('/', '');

liveReloadServer.watch(userWorkspace.pathname, () => {
console.info(`Now watching directory "${userWorkspace}" for changes.`);
return Promise.resolve(true);
console.info(`Now watching workspace directory (./${abridgedWorkspacePath}) for changes...`);
});

liveReloadServer.watch(userWorkspace.pathname);
}
}

Expand Down
Loading