File download link errors out at build for Excel files. "Unexpected character '' (1:2) #32428
-
Preliminary Checks
DescriptionWhen creating a simple download link to download pdf's and other files, everything works perfectly. However, when I try to import an .xlsx file for download, the gatsby build process errors out with:
The code is simple:
Reproduction LinkSteps to Reproduce
... Expected ResultThe excel file should import and allow me to create a download link. Actual ResultThe gatsby build errors out with:
EnvironmentSystem:
OS: Windows 10 10.0.18363
CPU: (6) x64 Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz
Binaries:
Node: 14.17.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
npm: 6.14.13 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.18362.449.0)
npmPackages:
gatsby: ^2.32.3 => 2.32.13
gatsby-image: ^2.11.0 => 2.11.0
gatsby-plugin-image: ^1.0.0 => 1.8.0
gatsby-plugin-manifest: ^2.12.0 => 2.12.1
gatsby-plugin-offline: ^3.10.0 => 3.10.2
gatsby-plugin-react-helmet: ^3.10.0 => 3.10.0
gatsby-plugin-sharp: ^2.14.1 => 2.14.4
gatsby-source-contentful: ^4.6.2 => 4.6.4
gatsby-source-filesystem: ^2.11.0 => 2.11.1
gatsby-transformer-remark: ^2.16.0 => 2.16.1
gatsby-transformer-sharp: ^2.12.0 => 2.12.1 Config FlagsNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You're trying to import a file directly into webpack that is not supported out of the box. You'd need to add an additional loader to support excel files: https://www.gatsbyjs.com/docs/how-to/images-and-media/importing-assets-into-files/ A quick solution to this is using the static folder: https://www.gatsbyjs.com/docs/how-to/images-and-media/static-folder#gatsby-skip-here |
Beta Was this translation helpful? Give feedback.
You're trying to import a file directly into webpack that is not supported out of the box. You'd need to add an additional loader to support excel files: https://www.gatsbyjs.com/docs/how-to/images-and-media/importing-assets-into-files/
A quick solution to this is using the static folder: https://www.gatsbyjs.com/docs/how-to/images-and-media/static-folder#gatsby-skip-here