We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 02a9706 + b6b21c6 commit 29ad7b1Copy full SHA for 29ad7b1
gulpfile.js
@@ -40,7 +40,14 @@ gulp.task('test', ['test-script-format', 'test-mocha']);
40
41
gulp.task('build-script', ['test'], () => (
42
gulp.src(['./src/index.js'])
43
- .pipe(webpackStream(webpackConfig, webpack))
+ .pipe(webpackStream(webpackConfig('node'), webpack))
44
+ .pipe(header(banner, { pkg }))
45
+ .pipe(gulp.dest('./lib/'))
46
+));
47
+
48
+gulp.task('build-script-web', ['test'], () => (
49
+ gulp.src(['./src/index.js'])
50
+ .pipe(webpackStream(webpackConfig('web'), webpack))
51
.pipe(header(banner, { pkg }))
52
.pipe(gulp.dest('./lib/'))
53
));
@@ -58,7 +65,7 @@ gulp.task('build-style', () => (
58
65
.pipe(gulp.dest('./lib'))
59
66
60
67
61
-gulp.task('build', ['build-script', 'build-style']);
68
+gulp.task('build', ['build-script', 'build-script-web', 'build-style']);
62
69
63
70
gulp.task('build-examples-style', () => (
64
71
gulp.src('./examples/src/scss/**/*.scss')
package.json
@@ -1,6 +1,6 @@
1
{
2
"name": "react-checkbox-tree",
3
- "version": "1.2.3",
+ "version": "1.2.4-rc.0",
4
"description": "A simple and elegant checkbox tree for React.",
5
"author": "Jake Zatecky",
6
"license": "MIT",
@@ -16,6 +16,7 @@
16
"homepage": "https://jakezatecky.github.io/react-checkbox-tree",
17
"bugs": "https://github.com/jakezatecky/react-checkbox-tree/issues",
18
"main": "lib/index.js",
19
+ "browser": "lib/index.browser.js",
20
"scripts": {
21
"build": "gulp build",
22
"examples": "gulp examples",
webpack.config.js
@@ -1,35 +1,45 @@
-module.exports = {
- mode: 'production',
- output: {
- filename: 'index.js',
- libraryTarget: 'umd',
- library: 'ReactCheckboxTree',
7
- },
8
- externals: [
9
- {
10
- react: {
11
- root: 'React',
12
- commonjs2: 'react',
13
- commonjs: 'react',
14
- amd: 'react',
15
+function makeConfig(target) {
+ const fileMap = {
+ node: 'index.js',
+ web: 'index.browser.js',
+ };
+ return {
+ mode: 'production',
+ target,
+ output: {
+ filename: fileMap[target],
+ libraryTarget: 'umd',
+ library: 'ReactCheckboxTree',
},
- 'react-dom': {
- root: 'ReactDOM',
- commonjs2: 'react-dom',
- commonjs: 'react-dom',
- amd: 'react-dom',
+ externals: [
+ {
+ react: {
+ root: 'React',
+ commonjs2: 'react',
+ commonjs: 'react',
+ amd: 'react',
+ },
23
24
25
- ],
26
- module: {
27
- rules: [
28
29
- test: /\.js?$/,
30
- exclude: /(node_modules|bower_components|vender_modules)/,
31
- loader: 'babel-loader',
+ 'react-dom': {
+ root: 'ReactDOM',
+ commonjs2: 'react-dom',
+ commonjs: 'react-dom',
+ amd: 'react-dom',
32
33
],
34
35
-};
+ module: {
+ rules: [
36
+ test: /\.js?$/,
37
+ exclude: /(node_modules|bower_components|vender_modules)/,
38
+ loader: 'babel-loader',
39
+ ],
+}
+module.exports = makeConfig;
0 commit comments