Skip to content

<script type="text/javascript"> in SFC breaks default Vue behavior #1324

Closed
@cristijora

Description

@cristijora

Version

3.0.0-beta.10

Reproduction link

https://github.com/cristijora/vue-sfc-script-bug

Steps to reproduce

Install deps and run the example

What is expected?

The app displays a message "My message" which is inside
App.vue (data)

Fallback, an intuitive error message is displayed that type="..." is not allowed on script tags inside Vue SFC

What is actually happening?

The app is not displaying the message
[Vue warn]: Property or method "msg" is not defined on the instance but referenced during render.


This happens because of
<script type="text/javascript"> in SFC. If you remove type="text/javascript" it works but it's very very confusing and hard to realize that the problem is because of type="text/javascript"
Also some editors might need this information in order to properly highlight code.

This might be related to vue-loader or webpack but posted it here since the previous webpack template seemed to not error out on such stuff.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions