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

Tagged templates inside data bindings #9721

Closed
torepettersen opened this issue Mar 16, 2019 · 2 comments
Closed

Tagged templates inside data bindings #9721

torepettersen opened this issue Mar 16, 2019 · 2 comments

Comments

@torepettersen
Copy link

Version

2.6.8

Reproduction link

https://codesandbox.io/s/626m32y4xw?fontsize=14

Steps to reproduce

Use tagged template inside data binding:

<span>{{ t`Hello ${'Vue'}`}}</span>

What is expected?

I would expect the data binding to return the result of the tagged template function.

What is actually happening?

I am getting an error message saying that tagged templates are not supported.


Initially thought this was a feature request since it says that tagged templates are not supported. But @posva closed the original issue #9719 and asked for a repro, so here it is.

@posva
Copy link
Member

posva commented Mar 16, 2019

The error is referring to buble transpiling those: Check https://vue-loader.vuejs.org/options.html#transpileoptions to add the relevant option printed in the message

@posva posva closed this as completed Mar 16, 2019
@torepettersen
Copy link
Author

Thanks for clarifying! That was a very well hidden feature.

In case someone else encounters the same problem. It is possible to enable tagged templates by changing the transpileOptions of vue-loader. Example with vue.config.js:

module.exports = {
  chainWebpack: config => {
    config.module
      .rule('vue')
      .use('vue-loader')
      .tap(options => {
        options.transpileOptions = {
          transforms: { dangerousTaggedTemplateString: true }
        };
        return options
      });
  },
};

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