How to use <script> tags in aurelia webpack project


#1

Hi,

I am building an application using Aurelia. Also I bought a template from WrapBootstrap called SmartAdmin and I want to use it in my app. The problem is that this template is not for Aurelia so I must cope with it.

What I have done is:

  1. Created a new project using Aurelia CLI: au new
  2. Selected Typescript and webpack
  3. Added Css and images (this works ok)
  4. Added some Html files
  5. Added *.js files from the template to a resources/js folder

Now the problem is that in the template it uses those .js files in script tags like this:

    <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
	<script>
		if (!window.jQuery.ui) {
			document.write('<script src="js/libs/jquery-ui.min.js"><\/script>');
		}
	</script>

    <!-- IMPORTANT: APP CONFIG -->
    <script src="resources/js/app.config.js"></script>
    <!-- MAIN APP JS FILE -->
    <script src="resources/js/app.min.js"></script>

I added this to my html file too but the script’s does not work. There are no error messages, but I think the .js file are not loaded on au run

How can I make this work without rewriting those .js files in typescript?

thanks


#2

Ok, I found a way using script-loader from webpack: https://github.com/webpack-contrib/script-loader but don’t know if this is the correct (supposed) way of doing it.