Reputation: 3269
I'm running a webpack-dev server to develop a Vue application (Vue CLI 3). Our company uses a custom templating language similar to ASP.NET (functions begin with <% prefix and close with %> suffix, and they're evaluated server-side), and this seems to cause a problem with the webpack-dev server. In the example below, I'm attempting to set the specs
variable to <%json_item_specifications%>
:
export default {
name: 'HelloWorld',
props: {
msg: String
},
data() {
return {
specs: <%json_item_specifications%>,
}
}
}
In the above example, webpack will escape the json function with an eval function and return this as part of the export:
eval("__webpack_require__.r(__webpack_exports__ ...
The leading eval causes the page to break, and I'm not sure exactly what part of the webpack stack causes this. I'm using the packaged webpack that comes with vue-cli 3, and I know that uses Babel under the hood.
I believe that Babel from webpack is parsing the <% as some other language and prepending the eval, but I can't find the parser configuration options online. Has anyone had issues with vue-cli parsing code in this way?
Any and all help is appreciated!
Upvotes: 1
Views: 301
Reputation: 410
I have two ideas about your issue:
Upvotes: 1