-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
How to preserve whitespace in Vue 3 and vue-cli (in slots) after PR #1600 is merged? #3849
Comments
In Vite it works in version export default defineConfig({
plugins: [
vue({
template: {
compilerOptions: {
whitespace: 'preserve'
}
}
})
] 🙏 🚀 But it doesn't in module.exports = {
chainWebpack: config => {
config.module
.rule('vue')
.use('vue-loader')
.loader('vue-loader')
.tap(options => {
// https://github.com/vuejs/vue-next/pull/1600
options.compilerOptions.whitespace = 'preserve'
return options
})
}
} |
If it works correctly in vite, then it should not be a problem with Vue, please make sure you install the correct dependencies when using with |
I changed vue.config.js exactly like yours. But
The project is created with {
"name": "vue3-demo",
"version": "0.1.0",
"private": true,
"scripts": {
"start": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
"core-js": "^3.6.5",
"vue": "^3.0.0",
"vue-class-component": "^8.0.0-0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-typescript": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0",
"typescript": "~4.1.5"
}
} @vue/cli 4.5.13 |
Version
3.0.11
Reproduction link
https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHRlbXBsYXRlPlxuICA8cHJlPlxuICAgIExpbmUgMVxuICAgIExpbmUgMlxuICA8L3ByZT5cbiAgICBcbiAgPHByZWNvZGU+XG4gICAgTGluZSAxIFxuICAgIExpbmUgMiBcbiAgPC9wcmVjb2RlPlxuPC90ZW1wbGF0ZT5cblxuPHNjcmlwdD5cbmltcG9ydCBQcmVjb2RlIGZyb20gXCIuL3ByZWNvZGUudnVlXCJcblxuZXhwb3J0IGRlZmF1bHQge1xuICBuYW1lOiBcIkFwcFwiLFxuICBjb21wb25lbnRzOiB7IFByZWNvZGUgfVxufVxuPC9zY3JpcHQ+IiwicHJlY29kZS52dWUiOiI8dGVtcGxhdGU+XG4gIDxwcmU+XG4gICAgPHNsb3Q+PC9zbG90PlxuICA8L3ByZT5cbjwvdGVtcGxhdGU+XG5cbjxzY3JpcHQ+XG5leHBvcnQgZGVmYXVsdCB7XG4gIFxufVxuPC9zY3JpcHQ+XG4iLCJ2dWUuY29uZmlnLmpzIjoiZXhwb3J0IGRlZmF1bHQge1xuICBwdWJsaWNQYXRoOiAndHJ1YycsXG4gIGNoYWluV2VicGFjazogKGNvbmZpZykgPT4ge1xuICAgIGNvbmZpZy5tb2R1bGVcbiAgICAgIC5ydWxlKFwidnVlXCIpXG4gICAgICAudXNlKFwidnVlLWxvYWRlclwiKVxuICAgICAgLmxvYWRlcihcInZ1ZS1sb2FkZXJcIilcbiAgICAgIC50YXAob3B0aW9ucyA9PiB7XG4gICAgICAgIC8vIGh0dHBzOi8vZ2l0aHViLmNvbS92dWVqcy92dWUtbmV4dC9wdWxsLzE2MDBcbiAgICAgICAgb3B0aW9ucy5jb21waWxlck9wdGlvbnMud2hpdGVzcGFjZSA9IFwicHJlc2VydmVcIlxuICAgICAgICByZXR1cm4gb3B0aW9uc1xuICAgICAgfSlcbiAgfVxufVxuIn0=
Steps to reproduce
pre
the slot does not keep the whitespaces entered by the user.
What is expected?
The whitespaces would be preserved.
What is actually happening?
The whitespaces are not preserved.
This is observable at
Related issues:
vuejs/vue-cli#5909
vitejs/vite#3531
#1600 (comment)
If there is anything I am missing, it would be very helpful to have a documentation about it for other users facing the same issue.
The text was updated successfully, but these errors were encountered: