提交 d73fbc8c 编写于 作者: Q qiang

chore: lint

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