提交 d73fbc8c 编写于 作者: Q qiang

chore: lint

上级 b381a51d
......@@ -135,7 +135,7 @@ const rules = [{
babelrc: false
}
},
jsPreprocessorLoader
jsPreprocessorLoader
]
// exclude (modulePath) { // nvue js均提供babel,否则还得提供transpileDependencies配置
// return excludeModuleReg.test(modulePath) && modulePath.indexOf('@dcloudio') === -1
......
......@@ -100,7 +100,7 @@ function getWebpackConfig (api, args, options) {
modifyConfig(webpackConfig, config => {
config.optimization.minimize = true
if (webpack.version[0] <= 4) {
config.optimization.namedModules = false
config.optimization.namedModules = false
}
})
} else {
......@@ -109,7 +109,7 @@ function getWebpackConfig (api, args, options) {
config.optimization = {}
}
if (webpack.version[0] <= 4) {
config.optimization.namedModules = false
config.optimization.namedModules = false
}
})
}
......
......@@ -172,8 +172,8 @@ module.exports = (api, options) => {
// launch editor support.
// this works with vue-devtools & @vue/cli-overlay
devServer.app.use('/__open-in-editor', launchEditorMiddleware(() => console.log(
`To specify an editor, specify the EDITOR env variable or ` +
`add "editor" field to your Vue project config.\n`
'To specify an editor, specify the EDITOR env variable or ' +
'add "editor" field to your Vue project config.\n'
)))
// allow other plugins to register middlewares, e.g. PWA
......@@ -189,42 +189,42 @@ module.exports = (api, options) => {
}), compiler)
} else {
server = new WebpackDevServer(compiler, Object.assign({
clientLogLevel: 'none',
historyApiFallback: {
disableDotRule: true,
rewrites: [{
from: /./,
to: path.posix.join(options.publicPath, 'index.html')
}]
},
contentBase: api.resolve('public'),
watchContentBase: !isProduction,
hot: !isProduction,
quiet: true,
compress: isProduction,
publicPath: options.publicPath,
overlay: isProduction // TODO disable this
? false : {
warnings: false,
errors: true
}
}, projectDevServerOptions, {
https: useHttps,
proxy: proxySettings,
before (app, server) {
clientLogLevel: 'none',
historyApiFallback: {
disableDotRule: true,
rewrites: [{
from: /./,
to: path.posix.join(options.publicPath, 'index.html')
}]
},
contentBase: api.resolve('public'),
watchContentBase: !isProduction,
hot: !isProduction,
quiet: true,
compress: isProduction,
publicPath: options.publicPath,
overlay: isProduction // TODO disable this
? false : {
warnings: false,
errors: true
}
}, projectDevServerOptions, {
https: useHttps,
proxy: proxySettings,
before (app, server) {
// launch editor support.
// this works with vue-devtools & @vue/cli-overlay
app.use('/__open-in-editor', launchEditorMiddleware(() => console.log(
'To specify an editor, sepcify the EDITOR env variable or ' +
app.use('/__open-in-editor', launchEditorMiddleware(() => console.log(
'To specify an editor, sepcify the EDITOR env variable or ' +
'add "editor" field to your Vue project config.\n'
)))
// allow other plugins to register middlewares, e.g. PWA
api.service.devServerConfigFns.forEach(fn => fn(app, server))
// apply in project middlewares
projectDevServerOptions.before && projectDevServerOptions.before(app,
server)
}
}))
)))
// allow other plugins to register middlewares, e.g. PWA
api.service.devServerConfigFns.forEach(fn => fn(app, server))
// apply in project middlewares
projectDevServerOptions.before && projectDevServerOptions.before(app,
server)
}
}))
}
;
......@@ -356,11 +356,11 @@ module.exports = (api, options) => {
if (webpack.version[0] > 4) {
server.start().catch(err => reject(err))
} else {
server.listen(port, host, err => {
if (err) {
reject(err)
}
})
server.listen(port, host, err => {
if (err) {
reject(err)
}
})
}
})
})
......
......@@ -139,7 +139,7 @@ const v3 = {
filename: '[name].js',
chunkFilename: '[id].js',
// webpack5 use strict
globalObject: webpack.version[0] > 4 ? `(new Function("return this")())` : 'this'
globalObject: webpack.version[0] > 4 ? '(new Function("return this")())' : 'this'
},
performance: {
hints: false
......
......@@ -70,15 +70,15 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
return rules.length > 0 && rule.use
} else {
const RuleSet = require('webpack/lib/RuleSet')
const normalized = RuleSet.normalizeRule(clone, {}, '')
return (
!rule.enforce &&
const normalized = RuleSet.normalizeRule(clone, {}, '')
return (
!rule.enforce &&
normalized.resource &&
normalized.resource(fakeFile)
)
)
}
}
}
}
function updateJsLoader (rawRules, fakeFile, checkLoaderRegex, loader) {
const matchRule = rawRules.find(createMatcher(fakeFile))
......@@ -185,18 +185,18 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
if (uses.find(use => babelLoaderRe.test(use.loader))) {
const index = uses.findIndex(use => cacheLoaderRe.test(use.loader))
if (index >= 0) {
if (process.env.UNI_USING_CACHE) {
Object.assign(uses[index].options, api.genCacheConfig(
'babel-loader/' + process.env.UNI_PLATFORM,
getPartialIdentifier()
))
} else {
uses.splice(index, 1)
if (process.env.UNI_USING_CACHE) {
Object.assign(uses[index].options, api.genCacheConfig(
'babel-loader/' + process.env.UNI_PLATFORM,
getPartialIdentifier()
))
} else {
uses.splice(index, 1)
}
}
}
}
}
}
// js preprocess
updateJsLoader(rawRules, 'foo.js', babelLoaderRe, {
......
......@@ -11,8 +11,8 @@ module.exports = function initCssnanoOptions (webpackConfig) {
}
const plugins = [require('cssnano')({
preset: ['default', getPlatformCssnano()]
})]
preset: ['default', getPlatformCssnano()]
})]
// TODO postcss-loader version > 4
if (webpack.version[0] > 4) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册