universal-vue / uvue

Vue CLI plugin to create universal Vue applications with ease
https://universal-vue.github.io/docs/
MIT License
127 stars 13 forks source link

css:sourceMap:true + stylus-loader = multiple Vue instantiations #59

Open phil294 opened 3 years ago

phil294 commented 3 years ago

Describe the bug The vue instantiation in main.js happens multiple times, once for every stylus stylesheet, if css source maps are activated. I dont know what possible further problems this may cause, but something is probably not right here.

To Reproduce

  1. In vue.config.js,
    css: {
        sourceMap: true,
    },
  2. Delete postcss.config.js (because it seems to overwrite the sourcemap setting or something like that)
  3. Install stylus and stylus-loader (v3.x for compatibility issues)
  4. Add some non-empty stylus style tags into some view or component
  5. On every page refresh, the vue instance will be created 1 + [number of files with some stylus stylesheets in it] times

Or just see the commit from the repro repo where I demonstrated this:

Reproduction repo/demo link run and check server console for the console.log from main.js

Expected behavior Only one vue instance creation per page refresh

Additional context

Please indicate versions of:

node: 12.20
vue-cli: 
uvue: 0.1.7
os: manjaro linux
browser: chromium latest
yabab-dev commented 3 years ago

Thanks again for this nice report!

You're right, when you have your browser devtools opened, this one will try to get source maps files and trigger a server-side rendering request...

I'll try to fix this, but this issue will only impact developers and not your actual users :)