Skip to content

Some module exports may break the build #6

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
Toilal opened this issue Mar 22, 2017 · 6 comments
Closed

Some module exports may break the build #6

Toilal opened this issue Mar 22, 2017 · 6 comments

Comments

@Toilal
Copy link
Contributor

Toilal commented Mar 22, 2017

For some reason, I need to create this dummy module ...

require("muicss/lib/sass/mui.scss");
require("./mui-layout.scss");

export default function(){};

This is not a Vue component at all, but vue-hot-reload-loader consider it is, and it then throw an exception inside the vue-hot-loader-api.

We should provide a way to ignore some module.

require("muicss/lib/sass/mui.scss");
require("./mui-layout.scss");

/* vue-hot-reload-loader: false */
export default function(){};

Also, we should think about improving the detection of Vue components to avoid using this comment on every non-component modules. Do you have any idea to enhance Vue component module detection ?

@ktsn
Copy link
Owner

ktsn commented Mar 23, 2017

I'm not sure that introducing such annotation comment is a good idea.
Why do you want to use this approach rather than adding include/exclude field in webpack config?

@Toilal
Copy link
Contributor Author

Toilal commented Mar 23, 2017

I don't want to end up with a big list of files to exclude in the webpack configuration. But I agree it's not optimal, and it requires configuration on previous loaders to preserve comments...

Best would be enhance the quality of components detection to make sure it only handle modules exporting a Vue component.

Another workaround is to stick to some filenaming convention like "hello.component.js" and configure the loader to include only "*. component.js" files.

@ktsn
Copy link
Owner

ktsn commented Mar 24, 2017

Hmm, I think detecting a component is impossible because a component can be any plain object. That likely cause false positive and true negative.

I'd rather decide directory/file name rules of component files to let the loader only be applied to components. It is clear enough for the users and they can control which files the loader should be used by themselves.

@Toilal
Copy link
Contributor Author

Toilal commented Mar 24, 2017 via email

@ktsn
Copy link
Owner

ktsn commented Mar 24, 2017

Yes, explaining about this in README is good idea.

@ktsn
Copy link
Owner

ktsn commented Mar 25, 2017

README is updated.

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

2 participants