Skip to content
This repository was archived by the owner on May 8, 2025. It is now read-only.

Commit f829692

Browse files
feat: replace correct ie version (#29)
* feat: replace correct ie version fixes #26 * fix: typo + file mode
1 parent 79611cf commit f829692

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

generator/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module.exports = (api, opts, rootOpts) => {
1515
api.onCreateComplete(() => {
1616
vuetify.addImports(api)
1717
opts.usePolyfill && polyfill.updateBabelConfig(api)
18+
opts.usePolyfill && polyfill.updateBrowsersList(api)
1819
opts.usePolyfill && polyfill.addImports(api)
1920
opts.useAlaCarte && alaCarte.updateBabelConfig(api)
2021
!opts.installFonts && fonts.addLinks(api, opts.iconFont)

generator/tools/polyfill.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,27 @@ function updateBabelConfig (api) {
3232
})
3333
}
3434

35+
function updateBrowsersList (api) {
36+
helpers.updateFile(api, './.browserslistrc', lines => {
37+
if (!lines.length) {
38+
return [
39+
'> 1%',
40+
'last 2 versions',
41+
'not ie <= 10',
42+
]
43+
}
44+
45+
const ieLineIndex = lines.findIndex(line => line.match(/^([^\s]*\s+|)ie\s*</))
46+
if (ieLineIndex === -1) {
47+
lines.push('not ie <= 10')
48+
} else {
49+
lines[ieLineIndex] = 'not ie <= 10'
50+
}
51+
52+
return lines
53+
})
54+
}
55+
3556
function addImports (api) {
3657
helpers.updateFile(api, api.entryFile, lines => {
3758
if (!lines.find(l => l.match(/^(import|require).*@babel\/polyfill.*$/))) {
@@ -46,4 +67,5 @@ module.exports = {
4667
addDependencies,
4768
updateBabelConfig,
4869
addImports,
70+
updateBrowsersList,
4971
}

0 commit comments

Comments
 (0)