Skip to content

RequireJS Module ID not loaded #479

Answered by jbsgh
Koshux asked this question in Q&A
Discussion options

You must be logged in to vote

My require.config.js looks like this:

require.config({
	paths: {
		moment: 'lib/moment.js/moment-with-locales.min',
		chartjs: 'lib/chart.js/Chart'
	},
	map: {
		'*': {
			'chart.js': 'chartjs'
		}
	},
	shim: {
		'chartjs': {
			deps: ['moment']
		}
	}
});

The trick is to map the module-name "chart.js" including the .js-suffix to the module-name "chartjs". This configuration allows RequireJS to load chart.js-plugins without any modification.

Replies: 11 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by kurkle
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants
Converted from issue

This discussion was converted from issue #73 on April 29, 2021 19:14.