Skip to content

Commit

Permalink
Update plugin-dev.md (#5231)
Browse files Browse the repository at this point in the history
  • Loading branch information
yeyan1996 committed Mar 6, 2020
1 parent 0569054 commit d84c074
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/dev-guide/plugin-dev.md
Expand Up @@ -251,7 +251,7 @@ First, we need to read main file content with Node `fs` module (which provides a
module.exports.hooks = (api) => {
api.afterInvoke(() => {
const fs = require('fs')
const contentMain = fs.readFileSync(api.entryFile, { encoding: 'utf-8' })
const contentMain = fs.readFileSync(api.resolve(api.entryFile), { encoding: 'utf-8' })
const lines = contentMain.split(/\r?\n/g)
})
}
Expand All @@ -265,7 +265,7 @@ Then we should to find the string containing `render` word (it's usually a part
module.exports.hooks = (api) => {
api.afterInvoke(() => {
const fs = require('fs')
const contentMain = fs.readFileSync(api.entryFile, { encoding: 'utf-8' })
const contentMain = fs.readFileSync(api.resolve(api.entryFile), { encoding: 'utf-8' })
const lines = contentMain.split(/\r?\n/g)
const renderIndex = lines.findIndex(line => line.match(/render/))
Expand All @@ -283,7 +283,7 @@ module.exports.hooks = (api) => {
api.afterInvoke(() => {
const { EOL } = require('os')
const fs = require('fs')
const contentMain = fs.readFileSync(api.entryFile, { encoding: 'utf-8' })
const contentMain = fs.readFileSync(api.resolve(api.entryFile), { encoding: 'utf-8' })
const lines = contentMain.split(/\r?\n/g)
const renderIndex = lines.findIndex(line => line.match(/render/))
Expand Down

0 comments on commit d84c074

Please sign in to comment.