npm list --depth=0)# npm list --depth=0
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
node -v): v11.5.0npm -v): 6.4.1Splitting template into separate html file doesn't work. Gives compilation errors.
Looks like two module.exports are generated, one with the html and one as an empty string.
I'm not sure this is the right place to report this, but I hit this wall when upgrading to latest mix following the documentation. Also tried doing the same thing from a clean Vue project, there was no issues. This is only an issue with latest version of laravel mix.
<template src="./ExampleComponent.html"></template>
<script src="./ExampleComponent.js"></script>
Contents of those file are simple the JS part and the HTML part of that original vue file.
Error:
ERROR in ./resources/js/components/ExampleComponent.html?vue&type=template&id=299e239e& (./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/html-loader!./resources/js/components/ExampleComponent.html?vue&type=template&id=299e239e&)
Module Error (from ./node_modules/vue-loader/lib/loaders/templateLoader.js):
(Emitted value instead of an instance of Error)
Error compiling template:
module.exports = "<div class=\"container\">\n <div class=\"row justify-content-center\">\n <div class=\"col-md-8\">\n <div class=\"card card-default\">\n <div class=\"card-header\">Example Component</div>\n\n <div class=\"card-body\">\n I'm an example component.\n </div>\n </div>\n </div>\n </div>\n</div>";
- text "module.exports = "" outside root element will be ignored.
@ ./resources/js/components/ExampleComponent.html?vue&type=template&id=299e239e& 1:0-198 1:0-198
@ ./resources/js/components/ExampleComponent.vue
@ ./resources/js/app.js
@ multi ./resources/js/app.js ./resources/sass/app.scss
I've now also tried it on a stand alone, without laravel. Still the same issue.
my-app.zip
# npm list --depth=0
[email protected]
โโโ [email protected]
```
ERROR in ./src/components/ExampleComponent.html?vue&type=template&id=6982cd3a& (./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/html-loader!./src/components/ExampleComponent.html?vue&type=template&id=6982cd3a&)
Module Error (from ./node_modules/vue-loader/lib/loaders/templateLoader.js):
(Emitted value instead of an instance of Error)
Error compiling template:
module.exports = "
@ ./src/components/ExampleComponent.html?vue&type=template&id=6982cd3a& 1:0-192 1:0-192
@ ./src/components/ExampleComponent.vue
@ ./src/app.js
@ multi ./src/app.js
``
I am having this same issue.
`ERROR in ./resources/assets/js/components/TermsAndSigns/view.html?vue&type=template&id=2dd81fad& (./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/html-loader!./resources/assets/js/components/TermsAndSigns/view.html?vue&type=template&id=2dd81fad&)
Module Error (from ./node_modules/vue-loader/lib/loaders/templateLoader.js):
(Emitted value instead of an instance of Error)
Error compiling template:
module.exports = "
@ ./resources/assets/js/components/TermsAndSigns/view.html?vue&type=template&id=2dd81fad& 1:0-198 1:0-198
@ ./resources/assets/js/components/TermsAndSigns/component.vue
@ ./resources/assets/js/app.js
@ multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss`
src/builder/webpack-rules.js
// Add support for loading HTML files.
rules.push({
test: /\.html$/,
loaders: ['html-loader']
});
If removed, then things just work. But that for sure will have some side effects?
+1 same issue
I found a work around until the issue is resolved: rename ExampleComponent.html -> ExampleComponent.htm
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@JeffreyWay This is still an issue. And reproducable. Any way to get this fixed properly?
Anyone looking into this?
Facing same issue!... +1
I make it like so & it works fine :
<scrpit>
export default MyVue{
template: require(โ./MyVue.htmlโ);
}
</scrpit>
Have the same problem, solutions from @jpscharf and @enghelewa are working.
Does anyone know is this possible to include HTML in Vue template instead of creating new nested component like so?
<template>
<div>
<h1>Component Header</h1>
<!-- include here separate HTML file -->
</div>
</template>
<template src="./test.html"></template> doesn't work.
Still facing the same issue.
Most helpful comment
I found a work around until the issue is resolved: rename
ExampleComponent.html->ExampleComponent.htm