-
-
Notifications
You must be signed in to change notification settings - Fork 6.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
Vue CLI sourcemaps to style part of vue component file #4029
Comments
Really? No one is using this? |
I'm able to edit file after removing |
@sodatea EDIT: |
As I wrote at SO I have found something.. I have found out that it is related to wrong sourcemap generated for those parts of Vue file <style> and <script> I have prepared additional loader for webpack which fixes those sourcemaps. Note it is workaround for webpack setup (not Vue CLI) What works ok: HRM Repo with working example: |
Step by step solution:
module.exports = {
css: {sourceMap: true},
devtool: 'cheap-source-map',
plugins: process.env.NODE_ENV === 'development' ?
([new MiniCssExtractPlugin()]) : [],
module: {
rules: [
process.env.NODE_ENV === 'development' ?
(
{
// test: /node_modules/,
test: /node_modules\/.+\.scss/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
importLoaders: 2,
sourceMap: true
}
},
{
loader: 'postcss-loader',
options: {
plugins: () => [require('autoprefixer')],
sourceMap: true
}
},
{
loader: 'sass-loader',
options: {sourceMap: true}
}
]
}) : {}
],
}
```
If you extract all css, you'll loose hmr (hot module reloading = reload on edit), but since you don't really edit scss in your `node_modules`, you extact only them.
All in all, this fixed all vue css-related sourcemap issues with Devtools and enabled hot-editing right in browser. |
Any updates on this issue or plans to fix it? I tried |
Version
3.7.0
Reproduction link
https://github.com/l00k/vue-sample
Environment info
Steps to reproduce
vue.config.js
(to enable sourcemaps)npm run serve
What is expected?
Sourcemap should point to full file component with edit available (as filesystem mount done)
What is actually happening?
Source tab presents only few lines with SCSS code (only style tag content). Edit is not available.
If you remove attribute
lang="scss"
full source of vue file will be presented, but still without option to edit file (via filesystem mount)I also created question with bounty on SO
https://stackoverflow.com/questions/56127998/vue-cli-sourcemaps-to-style-part-of-vue-component-file
The text was updated successfully, but these errors were encountered: