question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incompatibility with vue-cli modern mode

See original GitHub issue

Environment

  • Plugin Version: 0.5.5
  • Webpack Version: 4.28.1
  • OS Version: Debian 9
  • Node Version: 10
  • NPM Version: 6
  • @vue/cli-service Version: 3.3.0

Current Behavior

Uncaught TypeError: Cannot set property 'Obsolete' of undefined when opened in modern browser with modules support

Expected Behavior

Work fine in both modern and legacy browsers

Detailed Description

Here are documentation about modern mode - https://cli.vuejs.org/guide/browser-compatibility.html#modern-mode

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Djalercommented, Feb 15, 2019

I create a sample project for you - https://github.com/Djaler/obsolete-webpack-plugin-vue-cli-modern-mode-bug-sample

Steps to reproduce:

  1. npm install
  2. npm run build
  3. Run project using any HTTP-serve. For example, serve.
npm install -g serve
serve -s dist
  1. Open in modern browser (latest Chrome, for example)
  2. You will see error in console

This happens because in modern mode vue cli produces two versions for each script - for modern and legacy browsers. Modern browser will load <script type=module>: <script type=module src=/js/obsolete.5561cfbb.js></script> and will not load <script nomodule: <script src=/js/obsolete-legacy.5561cfbb.js nomodule></script>. And legacy browser will do the opposite.

The problem is that your script is not designed to run as an ES-module.

0reactions
Djalercommented, Feb 18, 2019

Awesome, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Browser Compatibility | Vue CLI
Vue CLI offers a "Modern Mode" to help you solve this problem. When building for production with the following command:.
Read more >
VUE CLI-3 Project not working on IE-11 - Stack Overflow
Another solution: use the power of vue-cli-3 to leverage browser support: https://cli.vuejs.org/guide/browser-compatibility.html#modern-mode.
Read more >
@vue/cli-plugin-babel | Yarn - Package Manager
Fix compatibility with the upcoming Vue 2.7 (currently in alpha) and Vue Loader 15.10 (currently in beta). In Vue 2.7, vue-template-compiler is no...
Read more >
Building for Production - Vite
Browser Compatibility #. The production bundle assumes support for modern JavaScript. By default, Vite targets browsers which support the native ES Modules, ...
Read more >
@vue/cli-plugin-babel - Awesome JS
Fix compatibility with the upcoming Vue 2.7 (currently in alpha) and Vue Loader 15.10 (currently in beta). In Vue 2.7, vue-template-compiler is no...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found