Reputation: 938
I have my application with the following structure
./
client/
.. some files
server/
server.js
widgets/
.. some files
webpack.conf.js
Now, I would like webpack
to ignore completely contents of the server/
directory. I know, that webpack is running the files from server.js
because when launching it on my own - I get EADDRINUSE. Webpack runs the server.js
file.
I have tried the following
include
and exclude
inside the module.loaders
module.noParse
resolve.root
Seems that all of above actions are performed after webpack reuires the server.js
file. Because if I put invalid param in for example module.loaders
and I put syntax error in server.js
I first see the syntax error and then the invalid param message in webpack.
Here's my webpack config
var path = require('path')
console.log(path.resolve(__dirname, 'client'))
module.exports = {
entry: './client/index.jsx',
output: {
publicPath: 'http://localhost:8090/assets'
},
module: {
loaders: [{
noParse: /server/,
test: /\.jsx$/,
loader: 'jsx-loader?insertPragma=React.DOM&harmony'
}, {
test: /\.scss$/,
loader: 'style!css!sass'
}
]
},
resolve: {
root: [
path.resolve(__dirname, 'client')
]
extensions: ['', '.js', '.jsx']
}
}
Launching webpack with:
webpack-dev-server --progress --colors --port 8090
Upvotes: 2
Views: 2861
Reputation: 1418
Webpack would only try to bundle files from server if you require them within your client. And there is no way that webpack is trying to execute your code.
So probably problem is not about webpack at all. I assume you have server already running on this port. Try to run webpack-dev-server on a different port.
Upvotes: 3