-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
import code snippet fail(BUG #1151 The situation still exists) #1297
Comments
Really wield. After first running, any change to the file you mentioned will be of no effect, even if you replace line.28 with something like I think it's a problem with cache system. If it is, don't be worried. Just wait for an update on |
@shigma Contribution welcome! |
@ulivz A release of 0.x may solve this issue, any plans? |
Released 0.14.9, @jiaming743 could you try the latest version? |
👍The problem has been solved. @ulivz @shigma But I found a situation: import test.js in test.md, then change the contents of test.js and press 'ctrl+s', the page has not changed after compile automatically. Then I switch to test.md and press 'ctrl+s', the page changed after compile automatically again. It seems that: changes to the imported file will not trigger the recompilation of the code snippet, you need to re-save the 'test.md' to trigger the code snippet compilation. Steps to reproducetest.js export default {
// this is a test file.
} test.md <<< @/dirpath/test.js current code snippet export default {
// this is a test file.
} setp1change test.js export default {
// test test test...
} press 'ctrl+s' in test.js compile automatically... current code snippet export default {
// this is a test file.
} No change setp2switch to test.md(No edits) press 'ctrl+s' in test.md compile automatically... current code snippet export default {
// test test test...
} changed |
It's because imported codes are not treated as dependencies at present, so changes to those files will not trigger hmr...... It's a long story. I have openned a new issue about that. |
Bug report
BUG #1151
According to @shigma 's advice
I removed ":"
myVuePressProject/node_modules/vuepress/lib/markdown/snippet.js#27
Before
const filename = rawPath.split(/[{:\s]/).shift()
After
const filename = rawPath.split(/[{\s]/).shift()
It still shows
Not found: E
What's more
I tried console.log(content) and the contents of the file can be read normally.
myVuePressProject/node_modules/vuepress/lib/markdown/snippet.js#28
const content = fs.existsSync(filename) ? fs.readFileSync(filename).toString() : 'Not found: ' + filename
Version
[email protected]
Steps to reproduce
What is expected?
show codes what I imported
What is actually happening?
show me
Not found: E
Other relevant information
The text was updated successfully, but these errors were encountered: