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

Commit

Permalink
修复 watch files 问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Darmody committed Feb 16, 2020
1 parent 230f5bc commit 3cae133
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export default class JSXElementPathSet {
this.id = 0;
}

public remove(module: string) {
this.paths.filter(p => p.module !== module);
}

private paths: JSXElementPath[] = [];
private id = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ function isEntryPath(node: t.JSXElement) {
*/
export default function visitJSXElement() {
return {
pre(state: any) {
jsxElementPathSet.remove(state.opts.filename);
},
visitor: {
JSXElement: (path: NodePath<t.JSXElement>, state: any) => {
if (!shouldBeTemplate(path)) {
Expand Down
2 changes: 0 additions & 2 deletions packages/remax-cli/src/build/plugins/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,6 @@ export default function template(
})
);

staticCompiler.jsxElementPathSet.clear();

templateAssets.forEach(file => {
this.emitFile({
type: 'asset',
Expand Down

0 comments on commit 3cae133

Please sign in to comment.