Skip to content
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.js Loader #49

Merged
merged 7 commits into from
Jun 29, 2017
Merged

Vue.js Loader #49

merged 7 commits into from
Jun 29, 2017

Conversation

weaverryan
Copy link
Member

No description provided.

@weaverryan weaverryan force-pushed the vuejs branch 2 times, most recently from 60b4b50 to 5de194e Compare June 23, 2017 01:42
@weaverryan weaverryan changed the title [WIP] Vue.js Loader Vue.js Loader Jun 23, 2017
@weaverryan
Copy link
Member Author

This is ready to go 🍰 Notes:

  • HMR works for JavaScript (wooohoo!) but not for styles, because we're using ExtractTextPlugin like the rest of the library (see Add HMR / Hot Support #3)

  • I added the .vue extension always, not just when the vue-loader is enabled. This should give better errors - if I use vue and require a .vue file without the extension, instead of not finding the file, you'll get an error about the vue-loader needing to be enabled.

@@ -35,10 +37,10 @@ module.exports = {

sassLoaders.push({
loader: 'sass-loader',
options: {
options: Object.assign(sassOptions, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should not alter the sassOptions object passed as argument. It could have side effects. Use this instead: Object.assign({}, sassOptions, { sourceMap: ... }) instead

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


scss: extractText.extract(
webpackConfig,
sassLoaderUtil.getLoaders(webpackConfig, {}, true),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't this require having sass-loader installed as soon as you use vue-loader, even if you never use Sass in your project, but less (same in the opposite way for the less config of course) ?

* That's because, in theory, you should be able to
* run Encore from other directories, give you set
* the context. However, in this case, the vue-loader
* users load-postcss-config to load the postcss config,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: uses

* run Encore from other directories, give you set
* the context. However, in this case, the vue-loader
* users load-postcss-config to load the postcss config,
* but it uses process.cwd() to find it, instead of the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the context an Encore thing or a webpack one ? If it is a webpack one, it would be worth discussing this upstream

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

context is a webpack thing... and it's meant to be the root from which entry files are loaded. It's unclear to me whether context should also be used for other things, like the directory where postcss.config.js should be loaded (we do give it a bit more importance in Encore)

@weaverryan
Copy link
Member Author

I added one more commit to change the vue-loader options to a callback - consistent with #50 and configureBabelLoader()

@weaverryan weaverryan merged commit 8c0aebd into symfony:master Jun 29, 2017
weaverryan added a commit that referenced this pull request Jun 29, 2017
This PR was merged into the master branch.

Discussion
----------

Vue.js Loader

Commits
-------

8c0aebd only adding alias when present
7b00ec8 Changing vue options to be a callback
2e1f9f7 Throw an error if the user tries to use (e.g.) lang="scss" in vue, but has not activated that loader
0d5cdd5 Completing vue-loader support
4094a73 Fix unit test
cf2c1a7 Add vue-template-compiler dependency
5207a28 Allow to add vues loader
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

Successfully merging this pull request may close these issues.

None yet

3 participants