Webpack compilation was succesful but fails to load in the browser. On checking the web console, I discovered some modules could not be accessed in _webpack_require_. When I changed the es6 import
syntax to require
in the concerned module, the error thrown in the web console goes away.
I don't intend going into every file and changing my import
syntax to require
. I have my .babelrc configured alongside with babel-loader in my webpack.config.js.
Really confused on what to do next as this is my first use of webpack
My webpack.config.js
***test: /\.(js|jsx)$/,
include: [
path.join(__dirname, 'client'),
path.join(__dirname, './template')
],
loader: 'babel-loader',
exclude: /node_modules/,
query: { cacheDirectory: true } ***
.babelrc file
{
"presets": [
"es2015",
"react",
"latest",
"stage-2"
],
"plugins": [
"react-hot-loader/babel"
]
}
flashMessage.js:13 Uncaught TypeError: Cannot read property 'ADD_FLASH_MESSAGE' of undefined at eval (flashMessage.js:13) at Object. (bundle.js:1406) at webpack_require (bundle.js:679) at fn (bundle.js:89) at eval (index.js:9) at Object. (bundle.js:1399) at webpack_require (bundle.js:679) at fn (bundle.js:89) at eval (index.js:9)