Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add undeclared dependencies and resolve others (fix #8286, fix #7581) #10277

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/lib/ssr/webpack.directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = function () {
chain.module.rule('node')
.test(/\.node$/)
.use('node-loader')
.loader('node-loader')
.loader(require.resolve('node-loader'))

chain.resolve.modules
.merge(resolveModules)
Expand Down
14 changes: 7 additions & 7 deletions app/lib/webpack/create-chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ module.exports = function (cfg, configName) {
})

vueRule.use('vue-loader')
.loader('vue-loader')
.loader(require.resolve('vue-loader'))
.options(
merge(
{},
Expand Down Expand Up @@ -164,7 +164,7 @@ module.exports = function (cfg, configName) {
))
.end()
.use('babel-loader')
.loader('babel-loader')
.loader(require.resolve('babel-loader'))
.options({
compact: false,
extends: appPaths.resolve.app('babel.config.js')
Expand All @@ -176,7 +176,7 @@ module.exports = function (cfg, configName) {
.rule('typescript')
.test(/\.ts$/)
.use('ts-loader')
.loader('ts-loader')
.loader(require.resolve('ts-loader'))
.options({
// custom config is merged if present, but vue setup and type checking disable are always applied
...(cfg.supportTS.tsLoaderConfig || {}),
Expand All @@ -196,7 +196,7 @@ module.exports = function (cfg, configName) {
extensions: {
vue: {
enabled: true,
compiler: '@vue/compiler-sfc'
compiler: require.resolve('@vue/compiler-sfc')
}
}
}
Expand All @@ -209,7 +209,7 @@ module.exports = function (cfg, configName) {
.test(/\.(png|jpe?g|gif|svg|webp|avif|ico)(\?.*)?$/)
.type('javascript/auto')
.use('url-loader')
.loader('url-loader')
.loader(require.resolve('url-loader'))
.options({
esModule: false,
limit: 10000,
Expand All @@ -221,7 +221,7 @@ module.exports = function (cfg, configName) {
.test(/\.(woff2?|eot|ttf|otf)(\?.*)?$/)
.type('javascript/auto')
.use('url-loader')
.loader('url-loader')
.loader(require.resolve('url-loader'))
.options({
esModule: false,
limit: 10000,
Expand All @@ -233,7 +233,7 @@ module.exports = function (cfg, configName) {
.test(/\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/)
.type('javascript/auto')
.use('url-loader')
.loader('url-loader')
.loader(require.resolve('url-loader'))
.options({
esModule: false,
limit: 10000,
Expand Down
2 changes: 1 addition & 1 deletion app/lib/webpack/electron/create-node-chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ module.exports = (nodeType, cfg, configName) => {
chain.module.rule('node')
.test(/\.node$/)
.use('node-loader')
.loader('node-loader')
.loader(require.resolve('node-loader'))

chain.resolve.modules
.merge(resolveModules)
Expand Down
2 changes: 1 addition & 1 deletion app/lib/webpack/inject.node-babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = function (cfg, chain) {
.add(/node_modules/)
.end()
.use('babel-loader')
.loader('babel-loader')
.loader(require.resolve('babel-loader'))
.options({
extends: appPaths.resolve.app('babel.config.js')
})
Expand Down
2 changes: 1 addition & 1 deletion app/lib/webpack/inject.node-typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = function (cfg, chain) {
.rule('typescript')
.test(/\.ts$/)
.use('ts-loader')
.loader('ts-loader')
.loader(require.resolve('ts-loader'))
.options({
// While `noEmit: true` is needed in the tsconfig preset to prevent VSCode errors,
// it prevents emitting transpiled files when run into node context
Expand Down
17 changes: 11 additions & 6 deletions app/lib/webpack/inject.style-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function injectRule (chain, pref, lang, test, loader, loaderOptions) {
function create (rule, modules) {
if (pref.isServerBuild === true) {
rule.use('null-loader')
.loader('null-loader')
.loader(require.resolve('null-loader'))
return
}

Expand All @@ -61,7 +61,7 @@ function injectRule (chain, pref, lang, test, loader, loaderOptions) {
}
else {
rule.use('vue-style-loader')
.loader('vue-style-loader')
.loader(require.resolve('vue-style-loader'))
.options({
sourceMap: pref.sourceMap
})
Expand All @@ -86,14 +86,14 @@ function injectRule (chain, pref, lang, test, loader, loaderOptions) {
}

rule.use('css-loader')
.loader('css-loader')
.loader(require.resolve('css-loader'))
.options(cssLoaderOptions)

if (!pref.extract && pref.minify) {
// needs to be applied separately,
// otherwise it messes up RTL
rule.use('cssnano')
.loader('postcss-loader')
.loader(require.resolve('postcss-loader'))
.options({
sourceMap: pref.sourceMap,
postcssOptions: {
Expand Down Expand Up @@ -149,12 +149,17 @@ function injectRule (chain, pref, lang, test, loader, loaderOptions) {
}

rule.use('postcss-loader')
.loader('postcss-loader')
.loader(require.resolve('postcss-loader'))
.options({ postcssOptions: postCssOpts })

if (loader) {
let resolvedLoader = loader
try {
resolvedLoader = require.resolve(loader)
} catch (err) { }

rule.use(loader)
.loader(loader)
.loader(resolvedLoader)
.options({
sourceMap: pref.sourceMap,
...loaderOptions
Expand Down
4 changes: 2 additions & 2 deletions app/lib/webpack/pwa/create-custom-sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ module.exports = function (cfg, configName) {
))
.end()
.use('babel-loader')
.loader('babel-loader')
.loader(require.resolve('babel-loader'))
.options({
compact: false,
extends: appPaths.resolve.app('babel.config.js')
Expand All @@ -103,7 +103,7 @@ module.exports = function (cfg, configName) {
.rule('typescript')
.test(/\.ts$/)
.use('ts-loader')
.loader('ts-loader')
.loader(require.resolve('ts-loader'))
.options({
onlyCompileBundledFiles: true,
transpileOnly: false,
Expand Down
2 changes: 1 addition & 1 deletion app/lib/webpack/ssr/webserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ module.exports = function (cfg, configName) {
chain.module.rule('node')
.test(/\.node$/)
.use('node-loader')
.loader('node-loader')
.loader(require.resolve('node-loader'))

chain.resolve.modules
.merge(resolveModules)
Expand Down
27 changes: 27 additions & 0 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"url": "https://donate.quasar.dev"
},
"dependencies": {
"@babel/core": "^7.9.0",
"@quasar/babel-preset-app": "2.0.1",
"@quasar/fastclick": "1.1.4",
"@quasar/ssr-helpers": "2.1.1",
Expand All @@ -55,7 +56,9 @@
"@vue/server-renderer": "3.1.5",
"archiver": "5.3.0",
"autoprefixer": "10.3.1",
"babel-loader": "^8.0.6",
"browserslist": "^4.12.0",
"loader-utils": "^2.0.0",
"chalk": "4.1.1",
"chokidar": "3.5.2",
"ci-info": "3.2.0",
Expand Down Expand Up @@ -114,6 +117,30 @@
"webpack-merge": "5.8.0",
"webpack-node-externals": "3.0.0"
},
"peerDependencies": {
"stylus-loader": "^6.1.0",
"less-loader": "^10.0.1",
"vue": "^3.1.5",
"vue-router": "^4.0.10",
"eslint": "^7.14.0"
},
"peerDependenciesMeta": {
"stylus-loader": {
"optional": true
},
"less-loader": {
"optional": true
},
"vue": {
"optional": true
},
"vue-router": {
"optional": true
},
"eslint": {
"optional": true
}
},
"engines": {
"node": ">= 12.22.1",
"npm": ">= 6.14.12",
Expand Down
7 changes: 1 addition & 6 deletions app/tsconfig-preset.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@
"pages/*": ["src/pages/*"],
"assets/*": ["src/assets/*"],
"boot/*": ["src/boot/*"]
},
// Forces quasar typings to be included, even if they aren't referenced directly
// Removing this would break `quasar/wrappers` imports if `quasar`
// isn't referenced anywhere, because those typings are declared
// into `@quasar/app` which is imported by `quasar` typings
"types": ["quasar"]
}
},
// Needed to avoid files copied into 'dist' folder (eg. a `.d.ts` file inside `src-ssr` folder)
// to be evaluated by TS when their original files has been updated
Expand Down
4 changes: 2 additions & 2 deletions docs/quasar.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ module.exports = function (ctx) {

chain.module.rule('pug')
.test(/\.pug$/)
.use('pug-loader').loader('pug-plain-loader')
.use('pug-loader').loader(require.resolve('pug-plain-loader'))

const rule = chain.module.rule('md')
.test(/\.md$/)

rule.use('v-loader')
.loader('vue-loader')
.loader(require.resolve('vue-loader'))
.options({
...(
isServer === true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const chainWebpack = function (ctx, chain) {
.pre()

rule.use('v-loader')
.loader('vue-loader')
.loader(require.resolve('vue-loader'))
.options({
productionMode: ctx.prod,
transformAssetUrls: {
Expand All @@ -64,7 +64,7 @@ const chainWebpack = function (ctx, chain) {
})

rule.use('ware-loader')
.loader('ware-loader')
.loader(require.resolve('ware-loader'))
.options({
raw: true,
middleware: function (source) {
Expand Down
6 changes: 3 additions & 3 deletions docs/src/pages/quasar-cli/handling-webpack.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ build: {
.add((/[\\/]node_modules[\\/]/))
.end()
.use('eslint-loader')
.loader('eslint-loader')
.loader(require.resolve('eslint-loader'))
}
}
```
Expand Down Expand Up @@ -171,7 +171,7 @@ build: {
chain.module.rule('json')
.test(/\.json$/)
.use('json-loader')
.loader('json-loader')
.loader(require.resolve('json-loader'))
}
}
```
Expand Down Expand Up @@ -212,7 +212,7 @@ build: {
chain.module.rule('pug')
.test(/\.pug$/)
.use('pug-plain-loader')
.loader('pug-plain-loader')
.loader(require.resolve('pug-plain-loader'))
}
}
```
Expand Down
6 changes: 6 additions & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@
"tslib": "^2.0.3",
"uglify-es": "^3.3.9"
},
"dependencies": {
"core-js": "^3.6.5"
},
"peerDependencies": {
"vue": "^3.1.5"
},
"vetur": {
"tags": "dist/vetur/quasar-tags.json",
"attributes": "dist/vetur/quasar-attributes.json"
Expand Down