Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add custom JS files from local system in JHipster Angular 2 Application

Can you guys suggest me how to add local js files in application

I have tried by adding the local JS file path in index.html like below

<script src="thirdpartyscripts/amcharts.js"></script>

Here **thirdpartyscripts** is my directory. but getting the error like below.

Error

like image 611
Rama Krishna Avatar asked Dec 05 '25 10:12

Rama Krishna


1 Answers

Copy this folder and file in your target/www folder. Or alternatively use webpack to do this for you in webpack.commons.js. Look at the last line I have added

new CopyWebpackPlugin([
            { from: './node_modules/core-js/client/shim.min.js', to: 'core-js-shim.min.js' },
            { from: './node_modules/swagger-ui/dist', to: 'swagger-ui/dist' },
            { from: './src/main/webapp/swagger-ui/', to: 'swagger-ui' },
            { from: './src/main/webapp/favicon.ico', to: 'favicon.ico' },
            { from: './src/main/webapp/manifest.webapp', to: 'manifest.webapp' },
            // { from: './src/main/webapp/sw.js', to: 'sw.js' },
            { from: './src/main/webapp/robots.txt', to: 'robots.txt' },
            { from: './src/main/webapp/thirdparty/sth.js', to: 'thirdparty/sth.js' }
        ]),
like image 140
pv1 Avatar answered Dec 09 '25 23:12

pv1



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!