-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
32 lines (32 loc) · 1.17 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const path = require('path'); // <-get absolute location for saving
const pkg = require('./package.json');
const nodeExternals = require('webpack-node-externals');
module.exports = {
entry: "./src/index.js", // <- starting point for bundle
output: {
path: path.resolve(__dirname, 'dist'), //<-where to save ur bundle
filename: "index.js", //<-filename for bundled file
library: pkg.name,
libraryTarget: "commonjs2" //<- to which version are we compiling js
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"]
}
]
},
target: 'node',
externals: [nodeExternals()]
// if we need to bundle anything extra with our code, if nothing entered means nothing else to compile, else we can mention, if, in case we want to bundle a particular third party code with our codebase
// if we need to bundle anything extra with our code (3rd party package),we can add it as an argument to this method.
// else, if nothing is passed as argument means no additional dependency to compile.
};