Tom-Bonnike / netlify-plugin-inline-source

A Netlify plugin to inline your assets/sources, built on top of the `inline-source` package.
https://www.npmjs.com/package/netlify-plugin-inline-source
MIT License
29 stars 8 forks source link

Error when using `javascript:void(0)` #8

Closed ehmicky closed 4 years ago

ehmicky commented 4 years ago

A project is using javascript:void(0) which shows the following error:

3:22:40 PM: build-image version: 30f629161c0736b1a3ecd8b418e5eeffab5c0faf
3:22:40 PM: build-image tag: v3.3.14
3:22:40 PM: buildbot version: 960d989224ecbd0e01be03c5f7dffe3d8f543e02
3:22:40 PM: Fetching cached dependencies
3:22:40 PM: Starting to download cache of 113.2MB
3:22:43 PM: Finished downloading cache in 3.312204871s
3:22:43 PM: Starting to extract cache
3:22:48 PM: Finished extracting cache in 4.640790262s
3:22:48 PM: Finished fetching cache in 8.001253191s
3:22:48 PM: Starting to prepare the repo for build
3:22:49 PM: Preparing Git Reference refs/heads/master
3:22:51 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'build' versus '/build' in the Netlify UI
3:22:51 PM: Starting build script
3:22:51 PM: Installing dependencies
3:22:52 PM: Started restoring cached node version
3:22:55 PM: Finished restoring cached node version
3:22:56 PM: v10.21.0 is already installed.
3:22:57 PM: Now using node v10.21.0 (npm v6.14.4)
3:22:57 PM: Started restoring cached build plugins
3:22:57 PM: Finished restoring cached build plugins
3:22:57 PM: Attempting ruby version 2.6.2, read from environment
3:22:59 PM: Using ruby version 2.6.2
3:22:59 PM: Using PHP version 5.6
3:22:59 PM: 5.2 is already installed.
3:22:59 PM: Using Swift version 5.2
3:22:59 PM: Started restoring cached node modules
3:22:59 PM: Finished restoring cached node modules
3:23:00 PM: Started restoring cached go cache
3:23:00 PM: Finished restoring cached go cache
3:23:00 PM: go version go1.12 linux/amd64
3:23:00 PM: go version go1.12 linux/amd64
3:23:00 PM: Installing missing commands
3:23:00 PM: Verify run directory
3:23:02 PM: ​
3:23:02 PM: ┌─────────────────────────────┐
3:23:02 PM: │        Netlify Build        │
3:23:02 PM: └─────────────────────────────┘
3:23:02 PM: ​
3:23:02 PM: ❯ Version
3:23:02 PM:   @netlify/build 1.0.14
3:23:02 PM: ​
3:23:02 PM: ❯ Flags
3:23:02 PM:   mode: buildbot
3:23:02 PM: ​
3:23:02 PM: ❯ Current directory
3:23:02 PM:   /opt/build/repo
3:23:02 PM: ​
3:23:02 PM: ❯ Config file
3:23:02 PM:   No config file was defined: using default values.
3:23:02 PM: ​
3:23:02 PM: ❯ Context
3:23:02 PM:   production
3:23:02 PM: ​
3:23:02 PM: ❯ Loading plugins
3:23:02 PM:    - netlify-plugin-inline-source@1.0.4 from Netlify app

...

3:23:44 PM: ┌──────────────────────────────────────────────────────────┐
3:23:44 PM: │ 5. onPostBuild command from netlify-plugin-inline-source │
3:23:44 PM: └──────────────────────────────────────────────────────────┘
3:23:44 PM: ​
3:23:45 PM: ​
3:23:45 PM: ┌──────────────────────────────────────────────┐
3:23:45 PM: │ Plugin "netlify-plugin-inline-source" failed │
3:23:45 PM: └──────────────────────────────────────────────┘
3:23:45 PM: ​
3:23:45 PM:   Error message
3:23:45 PM:   Error: Inlining sources failed.
3:23:45 PM:   ENOENT: no such file or directory, open '/opt/build/repo/build/javascript:void(0);'
3:23:45 PM: ​
3:23:45 PM:   Plugin details
3:23:45 PM:   Package:        netlify-plugin-inline-source
3:23:45 PM:   Version:        1.0.4
3:23:45 PM:   Repository:     git+https://github.com/Tom-Bonnike/netlify-plugin-inline-source.git
3:23:45 PM:   npm link:       https://www.npmjs.com/package/netlify-plugin-inline-source
3:23:45 PM:   Report issues:  https://github.com/Tom-Bonnike/netlify-plugin-inline-source/issues
3:23:45 PM: ​
3:23:45 PM:   Error location
3:23:45 PM:   In "onPostBuild" event in "netlify-plugin-inline-source" from Netlify app
3:23:45 PM:       at /opt/buildhome/.netlify-build-plugins/node_modules/inline-source/lib/load.js:19:41
3:23:45 PM:       at load (/opt/buildhome/.netlify-build-plugins/node_modules/inline-source/lib/load.js:12:10)
3:23:45 PM:       at /opt/buildhome/.netlify-build-plugins/node_modules/inline-source/lib/run.js:17:17
3:23:45 PM:       at run (/opt/buildhome/.netlify-build-plugins/node_modules/inline-source/lib/run.js:14:13)
3:23:45 PM:       at /opt/buildhome/.netlify-build-plugins/node_modules/inline-source/index.js:44:15

The repository is private. Is the error intended or is it a bug?

Tom-Bonnike commented 4 years ago

Prooobably a user error, they must have put an inline attribute on a tag with javascript:void(0) as src/href, which is weird because I think this only works on <a href> which inline-source would ignore. Without the actual HTML source, I can’t tell. :(

ehmicky commented 4 years ago

Yes, that's hard to guess indeed. Let's see if this happens again, and hopefully next time, this will be a public repository :)