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.

Upgrade vue-loader to webpack 3

See original GitHub issue

What problem does this feature solve?

With the recent launch of webpack 3, some exciting features was added, including Scope Hoisting. As stated by the team:

“Migrating from webpack 2 to 3, should involve no effort beyond running the upgrade commands in your terminal. We marked this as a Major change because of internal breaking changes that could affect some plugins.”

So, I believe the migration will be easy and will give only benefits:

npm install webpack@3.0.0 --save-dev

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
serkanyersencommented, Jun 20, 2017

I tried this today, vue loader works just fine with webpack 3, but when new webpack.optimize.ModuleConcatenationPlugin() is enabled, it prevents webpack from concatenating the modules. Because vue-loader by default converts export statements in vue files to module.exports and ModuleConcatenationPlugin bailsout on these statements.

If you enable --display-optimization-bailout option during build, it clearly says

module is used with non-harmony imports from ./src/App.vue

more details:
[7] ./src/App.vue 998 bytes {4} [built]
[8] ./node_modules/extract-text-webpack-plugin/loader.js?{"omit":1,"remove":true}!./node_modules/vue-style-loader!./node_modules/css-loader?minimize!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-f5e1a3ba","scoped":false,"hasInlineConfig":true}!./node_modules/sass-loader/lib/loader.js!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./src/App.vue 41 bytes {4} [built]
[10] ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/App.vue 130 bytes {4} [built]
       ModuleConcatenation (inner): module is used with non-harmony imports from ./src/App.vue
[14] ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-f5e1a3ba","preserveWhitespace":false}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/App.vue 385 bytes {4} [built]

I’ve tried setting esModule to true in vue loader config. but that also didn’t work.

2reactions
LinusBorgcommented, Jun 25, 2017

@erickpetru I’m not sure what you are asking - here should we update webpack? In this repository?

Or are you simply asking if vue-loader works with webpack 3?

The latter is: yes, but we are currently working on implementing true esmodule exports to reap the benefits of the ModuleConcatenationPlugin - which currently bails on .vue files as @serkanyersen correctly observed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrating from v14 - Vue Loader
We are in the process of upgrading Vue CLI 3 beta to use webpack 4 + Vue Loader v15, so you might want...
Read more >
vue-loader - npm
vue -loader is a loader for webpack that allows you to author Vue components in a format called Single-File Components (SFCs):.
Read more >
Vuejs 3 webpack : Problem with vue-template-compiler
To make vue 3 work fine with webpack without using vite or vue cli follow these steps : init the package.json like :....
Read more >
06 April 2020 - Webpack for Vue 3 - Lachlan Miller
In this article we build a webpack configuration from scratch for developing Vue.js 3 apps. Specifically, we will support .vue files, ...
Read more >
How to setup a vue project with webpack. - DEV Community ‍ ‍
Configure webpack to use babel loader, and vue loader ... Run npm install vue vue-router core-js --save this would install the three ......
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