Given the following Webpack 2 configuration, I want to write a express app using ES6. My .babelrc
has only the es2015
preset:
const path = require('path');
module.exports = {
target: 'node',
entry: path.resolve(__dirname, 'src', 'server.js'),
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'server.bundle.js',
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
use: 'babel-loader',
},
],
},
};
Running webpack and starting the server work fine, but when accessing the URL through the browser I get the following error:
Error: Cannot find module "."
at webpackMissingModule (/Users/Me/project/dist/server.bundle.js:18208:74)
I don't know whether it's due to the .
in a require('./some/other/file')
call (not all files are ES6, so these one use require()
instead of import
); or maybe some configuration I'm missing.
And also, given that stack trace I can't really map it to the original source file.
Thanks in advance
via Christopher Francisco
No comments:
Post a Comment