Page MenuHomePhabricator

Cannot require undefined file ../contributionEvents.js
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:
Error in console:

Error: Cannot require undefined file ../contributionEvents.js
    at require (startup.js:1006:11)
    at StoryViewer.vue (StoryViewer.vue:12:28)
    at require (startup.js:1013:5)
    at index.js (index.js:2:21)
    at runScript (startup.js:1279:6)
    at Array.<anonymous> (startup.js:1348:6)
    at flushCssBuffer (startup.js:597:28)

What should have happened instead?:
no error.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Event Timeline

Change #1067418 had a related patch set uploaded (by Sbisson; author: Sbisson):

[mediawiki/extensions/Wikistories@master] Fix instrumentation file path

https://gerrit.wikimedia.org/r/1067418

SBisson triaged this task as Medium priority.
SBisson added subscribers: eamedina, hueitan.

Pinging @hueitan and @eamedina for code review

@SBisson I notice the definition of this module looks a bit odd:

"ext.wikistories.viewer": {
			"localBasePath": "resources/ext.wikistories.viewer",
			"packageFiles": [
				"index.js",
				"StoryViewer.vue",
				{
					"name": "consumptionEvents.js",
					"file": "../instrumentation/consumptionEvents.js"
				},
				{
					"name": "contributionEvents.js",
					"file": "../instrumentation/contributionEvents.js"
				},

While the above works fine, I'd love the know if the following also works. If not, I'd welcome a MediaWiki-ResourceLoader bug report as this imho should work!

"ext.wikistories.viewer": {
			"localBasePath": "resources/ext.wikistories.viewer",
			"packageFiles": [
				"index.js",
				"StoryViewer.vue",
				"../instrumentation/consumptionEvents.js"
				"../instrumentation/contributionEvents.js"

Change #1067418 merged by jenkins-bot:

[mediawiki/extensions/Wikistories@master] Fix instrumentation file path

https://gerrit.wikimedia.org/r/1067418

Change #1067994 had a related patch set uploaded (by Sbisson; author: Sbisson):

[mediawiki/extensions/Wikistories@master] Simplify shared files declaration in modules definition

https://gerrit.wikimedia.org/r/1067994

While the above works fine, I'd love the know if the following also works. If not, I'd welcome a MediaWiki-ResourceLoader bug report as this imho should work!

"ext.wikistories.viewer": {
			"localBasePath": "resources/ext.wikistories.viewer",
			"packageFiles": [
				"index.js",
				"StoryViewer.vue",
				"../instrumentation/consumptionEvents.js"
				"../instrumentation/contributionEvents.js"

It seems to work just fine as illustrated in the patch linked above. Of course it makes the require statements more verbose but it's just loading the files from where they actually are so there is nothing wrong with that.

Change #1067994 merged by jenkins-bot:

[mediawiki/extensions/Wikistories@master] Simplify shared files declaration in modules definition

https://gerrit.wikimedia.org/r/1067994