Skip to content

Commit

Permalink
split fix for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jan 9, 2018
1 parent 902f6c0 commit f13761d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/@vue/cli-plugin-pwa/generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = api => {
const main = files['src/main.js']
if (main) {
// inject import for registerServiceWorker script into main.js
const lines = main.split('\n').reverse()
const lines = main.split(/\r?\n/g).reverse()
const lastImportIndex = lines.findIndex(line => line.match(/^import/))
lines[lastImportIndex] += `\nimport './registerServiceWorker'`
files['src/main.js'] = lines.reverse().join('\n') + '\n'
Expand Down

0 comments on commit f13761d

Please sign in to comment.