简体   繁体   中英

can not load require.js main module

I'm trying to use require.js in my app but it looks like it doesnt see the path of the main.

There is script for loading:

<script data-main='public/scripts/main.js' src='public/scripts/require.js'></script>

i tried everything /public/scripts/main.js, public/scripts/main and others but im still getting:

Uncaught SyntaxError: Unexpected identifier
at exec (require.js:2410)
at XMLHttpRequest.xhr.onreadystatechange (require.js:2421)

I think the problem is in the node middleware path, when I'm trying to load it with just index.html and scripts it works, but with whole backend stuff it doesn't :(

There is how I set /public in node:

  Server.app.use('/public', express.static(path.join(__dirname, 'public')));

Any one know the solution?

您可以重试:

<script data-main='/public/scripts/main.js' src='/public/scripts/require.js'></script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM