Skip to content

Line 0 script breaks the loader #1132

Closed
@ArtemGovorov

Description

@ArtemGovorov

Version

13.7.0

Reproduction link

acaf6a6#commitcomment-26936408

Steps to reproduce

Create a vue component with the <script> as a first line in the file and some code right on that line, for example:

<script>import Hello from './components/Hello'

export default {
  name: 'app',
  components: {
    Hello
  }
}
</script>
...

What is expected?

Working webpack build.

What is actually happening?

Error:

ERROR in ./src/App.vue
Module build failed: Error: Invalid mapping: {"generated":{"line":1,"column":0},"source":"App.vue","original":{"line":0,"column":0},"name":null}
    at SourceMapGenerator_validateMapping [as _validateMapping] (./node_modules/source-map/lib/source-map-generator.js:298:13)
    at SourceMapGenerator_addMapping [as addMapping] (./node_modules/source-map/lib/source-map-generator.js:110:12)
    at generated.split.forEach (./node_modules/vue-loader/lib/parser.js:56:11)
    at Array.forEach (<anonymous>)
    at generateSourceMap (./node_modules/vue-loader/lib/parser.js:54:28)
    at module.exports (./node_modules/vue-loader/lib/parser.js:17:29)
    at Object.module.exports (./node_modules/vue-loader/lib/loader.js:108:17)
 @ ./src/main.js 3:0-24

This used to work before this change acaf6a6

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