Skip to content

vue-loader breaks since Webpack 2.1.0-beta.26 #464

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

Closed
riovir opened this issue Nov 14, 2016 · 8 comments
Closed

vue-loader breaks since Webpack 2.1.0-beta.26 #464

riovir opened this issue Nov 14, 2016 · 8 comments

Comments

@riovir
Copy link

riovir commented Nov 14, 2016

https://github.com/webpack/webpack/releases/tag/v2.1.0-beta.26
The breaking change now forces -loader to be used. Since vue-loader internally also uses loaders the problem might be caused by this change. See:

Error: Module '....../node_modules/less/index.js' is not a loader

@riovir
Copy link
Author

riovir commented Nov 14, 2016

In the loader.js the line 80 the following horrible hack solves the problem:
getLoaderString(type, part, index, scoped).replace(/!less!/, '!less-loader!')

Naturally this is not a proposed fix, merely a step to pin down the issue.

@riovir
Copy link
Author

riovir commented Nov 14, 2016

An actual proposal here for a fix:
loader.js@line 155
return loader + '!' + rewriter + lang + '-loader!'

Edit: the same idea seems to be necessary for 'script' and 'template cases' as well in getLoaderString

riovir added a commit to riovir/vue-loader that referenced this issue Nov 14, 2016
…heir full name (vuejs#464)

* In Webpack 2 loaders have to be explicitly declared, the "-loader" part of their name is no longer implied.
yyx990803 added a commit that referenced this issue Nov 14, 2016
…heir full name (#464) (#465)

* In Webpack 2 loaders have to be explicitly declared, the "-loader" part of their name is no longer implied.
@thorning
Copy link

thorning commented Nov 15, 2016

I had this problem using lang="stylus" and a (temporary) fix for me was to change it to lang="stylus-loader", I also had to update loader references in the webpack config.

A fix should be tested for pug/jade support in templates, as it seems these needs the normal modules (i.e. 'pug') and not the loader module ('pug-loader')

@ylhuang0423
Copy link

ylhuang0423 commented Nov 15, 2016

I' m using Webpack 1.13.3 (npm version)
resolveLoader.alias is set in webpack.config.js (i.e sugarss: 'postcss-loader?parser=sugarss')
The fix would break my setting, because sugarss becomes sugarss-loader implicitly.

@riovir
Copy link
Author

riovir commented Nov 15, 2016

@thorning, I tested the "fix" with both Jade and Pug. For templates "raw" changes to "raw-loader" the engine query param stays the same. See:
case 'template': return defaultLoaders.html + '!' + templateLoaderPath + '?raw-loader&engine=' + lang + '!'

@ylhuang0423, Breaking resolveLoader.alias is a different matter though. I don't have a good proposal on how to safely tell an aliased lang from a default one that needs a -loader suffix. Does anything make them special that the vue-loader can possibly recognize?

@ylhuang0423
Copy link

ylhuang0423 commented Nov 15, 2016

@riovir, Maybe try...catch to require loaders (like what var hasBabel do) would be a possible solution.
If the loader of lang is existed indeed then suffix -loader to it, or it'll be a Inline Loader Request or a alias.

Yet it's not a perfect solution for some special cases.
(i.e babel could be aliased like: babel: 'babel-loader?presets[]=latest,presets[]=stage-3')

@yyx990803
Copy link
Member

Can you try 9.9.3?

@riovir
Copy link
Author

riovir commented Nov 15, 2016

9.9.3 works well with Webpack 2 beta 26 as far as I managed to verify, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants