I am trying to use require js and laravel to manage the assets directory. I have placed the require.js file in the assets/js directory, along with main.js. The main.js file contains:
require.config({
baseURL: '',
paths: {
userPreview: 'userPreview.js'
}
})
The userPreview.js file is also located in the assets/js directory, so the directory structure looks like this -
assets / js / require.js main.js userPreview.js
In my PHP file, I have included the following script tag:
<script data-main="assets/js/main" src="assets/js/require.js"></script>
However, I am encountering the error "Uncaught ReferenceError: UserPreview is not defined"!
Upon checking Google Developers Tool, I can confirm that both require.js and main.js are loaded. What could be causing this issue?