Skip to content

Commit 1d16d06

Browse files
author
AJ Keller
committed
ADD: webpack config
1 parent 6475bdc commit 1d16d06

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "openbci-utilities",
33
"version": "0.3.0",
44
"description": "The official utility package of Node.js SDK for the OpenBCI Biosensor Boards.",
5-
"main": "dist/openbci.utils.js",
5+
"main": "dist/openbciutilities.umd.js",
66
"module": "src/index.js",
77
"scripts": {
88
"build": "webpack",

webpack.config.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const path = require('path');
2+
3+
const library = 'OpenBCIUtilities';
4+
const libraryExport = 'default';
5+
6+
const config = {
7+
entry: './src/index.js',
8+
module: {
9+
rules: [
10+
{
11+
test: /\.js$/,
12+
exclude: /(node_modules)/,
13+
use: {
14+
loader: 'babel-loader'
15+
}
16+
}
17+
]
18+
},
19+
devtool: 'eval',
20+
devServer: {
21+
compress: true,
22+
port: 9000
23+
}
24+
};
25+
26+
const exportLibraryTarget = libraryTarget =>
27+
Object.assign({}, config, {
28+
output: {
29+
path: path.resolve(__dirname, 'dist'),
30+
filename: `${library.toLowerCase()}.${libraryTarget}.js`,
31+
library,
32+
libraryTarget,
33+
libraryExport
34+
}
35+
});
36+
37+
module.exports = [
38+
exportLibraryTarget('umd'),
39+
exportLibraryTarget('var'),
40+
];

0 commit comments

Comments
 (0)