forked from dreyescat/react-rating
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
63 lines (62 loc) · 1.86 KB
/
Copy pathwebpack.config.js
File metadata and controls
63 lines (62 loc) · 1.86 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
var webpack = require('webpack');
var PACKAGE = require('./package.json');
var banner = PACKAGE.name + ' - ' + PACKAGE.version + ' | ' +
'(c) 2015, ' + new Date().getFullYear() + ' ' + PACKAGE.author + ' | ' +
PACKAGE.license + ' | ' +
PACKAGE.homepage;
module.exports = {
entry: {
'react-rating': './src/react-rating.js'
},
output: {
// Output the bundled file.
path: './lib',
// Use the name specified in the entry key as name for the bundle file.
filename: '[name].js',
// Export as a Universal Module Definition library.
library: 'ReactRating',
libraryTarget: 'umd',
// The modified bundle is served from memory at the relative path
// specified in publicPath.
// I use the same as the output path to use the same index.html either
// served by webpack-dev-server or as a static file loaded in the browser.
publicPath: '/lib'
},
module: {
loaders: [
{
// Test for js or jsx files.
test: /\.jsx?$/,
exclude: /node_modules/,
loaders: [
"babel-loader",
"eslint-loader"
]
}
]
},
externals: {
// Don't bundle the 'react' npm package with the component.
'react': {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react'
}
},
resolve: {
// Include empty string '' to resolve files by their explicit extension
// (e.g. require('./somefile.ext')).
// Include '.js', '.jsx' to resolve files by these implicit extensions
// (e.g. require('underscore')).
extensions: ['', '.js', '.jsx']
},
plugins: [
new webpack.DefinePlugin({
// If BUILD_DEV is in process environment, return true. Otherwise,
// return (void 0). BUILD_DEV=1 before webpack command will do the job.
__DEV__: process.env.BUILD_DEV && 'true'
}),
new webpack.BannerPlugin(banner)
]
};