I'm using React for he first time and I discover that there are some JS functions I need to use accross multiple JSX files.
I've looked at some examples, but can't figure out how to correctly include my global.js file.
My folder structure:
/dist
/src
/components
/sass
/img
index.js
global.js
webpack.config.js
This is my webpack file:
var path = require('path');
var webpack = require('webpack');
module.exports = {
entry: "./src/index.js",
output: {
path: __dirname + "/js/",
filename: "bundle.js"
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel',
query: {
cacheDirectory: true,
presets: ['es2015', 'react']
}
}
]
}
};
Can anyone tell me how to correctly include this one file and where in the webpack code this goes?