Skip to content

UTF-8 Byte-Order-Mark BOM issue #2868

@JasonGoemaat

Description

@JasonGoemaat

I'm submitting a bug report
BOM (byte order mark) from UTF-8 files are included in the bundle causing 'unexpected token' errors.

Webpack version:
2.1.0-beta.20 (problem doesn't exist with Webpack 1.1.13)

Please tell us about your environment:
Windows 10

Current behavior:
Using private node modules created from wijmo 3rd party library that contains javascript files with BOM, the BOM is included in the middle of the bundle causing an error: 'Invalid or undexpected token'. That's the weird characters after __WEBPACK_AMD_DEFINE_RESULT below:

// },
/
775 /
/
/ function(module, exports, webpack_require) {

var WEBPACK_AMD_DEFINE_ARRAY, WEBPACK_AMD_DEFINE_RESULT;/*
*

Expected/desired behavior:
Only the text of the file should be included, not the byte order mark

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem along with a gist/jsbin of your webpack configuration.
    Sorry I can't provide the node module since it contains code from a 3rd party, and am unsure how to create a sample node module that is a library...
  • What is the expected behavior?
    When reading any file, the byte order mark should not be included in the output.
  • What is the motivation / use case for changing the behavior?
    I don't think there's a reason to include the BOM, and it can cause errors depending on how a file is saved.
  • Browser: all
  • Language: Typescript importing from Javascript

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions