Skip to content

Commit ef7c80d

Browse files
m0dch3nrstoenescu
authored andcommitted
solve TypeScript problem, make quasar external file js file (#10)
1 parent 1dd4a89 commit ef7c80d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

generator/index.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ module.exports = (api, opts) => {
4545
const plugins = []
4646

4747
const
48+
quasarPath = api.resolve('./src/quasar.js'),
4849
tsPath = api.resolve('./src/main.ts'),
4950
jsPath = api.resolve('./src/main.js'),
5051
hasTS = fs.existsSync(tsPath)
@@ -112,12 +113,12 @@ module.exports = (api, opts) => {
112113
extendBabel(api)
113114
}
114115

116+
let lines = `import Vue from 'vue'\n`
117+
115118
const
116119
hasIconSet = opts.quasar.iconSet !== 'material-icons',
117120
hasLang = opts.quasar.lang !== 'en-us'
118121

119-
let lines = '\n'
120-
121122
if (!opts.quasar.features.includes(opts.quasar.iconSet)) {
122123
opts.quasar.features.push(opts.quasar.iconSet)
123124
}
@@ -202,10 +203,12 @@ module.exports = (api, opts) => {
202203
const mainLines = content.split(/\r?\n/g).reverse()
203204

204205
const index = mainLines.findIndex(line => line.match(/^import/))
205-
mainLines[index] += lines
206+
mainLines[index] += `\nimport './quasar'`
206207

207208
content = mainLines.reverse().join('\n')
208209
fs.writeFileSync(mainPath, content, { encoding: 'utf8' })
210+
211+
fs.writeFileSync(quasarPath, lines, { encoding: 'utf8' })
209212
}
210213

211214
if (api.generator.hasPlugin('@vue/cli-plugin-eslint')) {

0 commit comments

Comments
 (0)