dvdzkwsk / react-redux-starter-kit

Get started with React, Redux, and React-Router.
MIT License
10.29k stars 2.2k forks source link

How to add my external js files using webpack File-loader #1231

Closed sivakumarp0030 closed 7 years ago

sivakumarp0030 commented 7 years ago

Hi Team @daviferreira @AndreiRailean @brancusi @przeor @kid

In my react-redux application ,Currently i have included my external javascripts files in my main index.html body portion .like this

!doctype html>

React Todos Example

But added javascript functionality not working properly .While googling the solutions for this issue .i could found some posted block like we needs to add our external external javascripts files using webpack file-loaders .I have kept my downloaded javascripts file outside of my /src folder.

The external javascripts are currently in /JS folder (js/jquery-2.1.1.min.js,init.js) .

My webpack.config.js file looks like

var path = require('path') var webpack = require('webpack')

module.exports = { devtool: 'inline-source-map', entry: [ 'webpack-hot-middleware/client', './client/index.js' ], output: { path: path.join(__dirname, 'dist'), filename: 'bundle.js', publicPath: '/static/' }, plugins: [ new webpack.optimize.OccurrenceOrderPlugin(), new webpack.HotModuleReplacementPlugin() ], module: { loaders: [ { test: /.js$/, loader: 'babel', exclude: /node_modules/, include: __dirname, query: { presets: [ 'react-hmre' ] } } ] } }

Could please provide the correct way of adding the external javascripts in my react-redux application .

Thanks Siva.P

AndreiRailean commented 7 years ago

These kinds of questions should go to stack overflow

dvdzkwsk commented 7 years ago

Thank you @AndreiRailean . Good luck @sivapavi !