Skip to content

Commit 006e46c

Browse files
committed
FS-12113: Resolved webpack and gulp config
1 parent 632e1f9 commit 006e46c

File tree

2 files changed

+18
-23
lines changed

2 files changed

+18
-23
lines changed

scripts/build.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,22 @@ gulp.task('typescript:modules', () => {
3636
});
3737

3838
gulp.task('build:webpack:umd', () => {
39-
const conf = webpackCfg.umd;
39+
const conf = webpackCfg[0];
4040
return gulp.src(conf.entry)
4141
.pipe(webpack(conf))
4242
.pipe(gulp.dest(conf.output.path));
4343
});
4444

4545
gulp.task('build:webpack:esm', () => {
46-
const conf = webpackCfg.esm;
46+
const conf = webpackCfg[1];
4747

4848
return gulp.src(conf.entry)
4949
.pipe(webpack(conf))
5050
.pipe(gulp.dest(conf.output.path));
5151
});
5252

5353
gulp.task('build:webpack:prod', () => {
54-
const conf = webpackCfg.prod;
54+
const conf = webpackCfg[2];
5555

5656
return gulp.src(conf.entry)
5757
.pipe(webpack(conf))

webpack.config.js

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,12 @@ const WebpackAssetsManifest = require('webpack-assets-manifest');
77
const { SourceMapConsumer } = require('source-map');
88
const banner = fs.readFileSync('./LICENSE', 'utf8').replace('{year}', new Date().getFullYear());
99

10-
const config = {
10+
const baseConfig = {
1111
mode: 'production',
1212
watchOptions: {
1313
ignored: /node_modules/
1414
},
1515
entry: './build/module/index.js',
16-
output: {
17-
library: {
18-
type: 'umd',
19-
},
20-
path: path.resolve(__dirname, 'build/browser'),
21-
filename: 'filestack.umd.js',
22-
},
2316
module: {
2417
rules: [
2518
{
@@ -68,9 +61,9 @@ const config = {
6861
new webpack.BannerPlugin({ banner }),
6962
new webpack.DefinePlugin({
7063
'process.env.NODE_ENV': JSON.stringify('production'),
71-
'@{VERSION}' : JSON.stringify(`${require('./package.json').version}`),
64+
'@{VERSION}': JSON.stringify(`${require('./package.json').version}`),
7265
}),
73-
new webpack.NormalModuleReplacementPlugin(/\.node$/, (resource) => {
66+
new webpack.NormalModuleReplacementPlugin(/\.node$/, (resource) => {
7467
resource.request = resource.request.replace(/\.node$/, '.browser');
7568
}),
7669
],
@@ -90,17 +83,19 @@ const config = {
9083
},
9184
};
9285

93-
const umd = merge({}, config, {
86+
const umd = merge({}, baseConfig, {
9487
output: {
95-
library: {
96-
type: 'umd',
97-
},
88+
path: path.resolve(__dirname, 'build/browser'),
9889
filename: 'filestack.umd.js',
90+
library: 'filestack',
91+
libraryTarget: 'umd',
92+
9993
},
10094
});
10195

102-
const esm = merge({}, config, {
96+
const esm = merge({}, baseConfig, {
10397
output: {
98+
path: path.resolve(__dirname, 'build/browser'),
10499
filename: 'filestack.esm.js',
105100
library: {
106101
type: 'module',
@@ -115,12 +110,12 @@ const esm = merge({}, config, {
115110
},
116111
});
117112

118-
const prod = merge({}, config, {
113+
const prod = merge({}, baseConfig, {
119114
output: {
120-
library: {
121-
type: 'umd',
122-
},
115+
path: path.resolve(__dirname, 'build/browser'),
123116
filename: 'filestack.min.js',
117+
library: 'filestack',
118+
libraryTarget: 'umd'
124119
},
125120
plugins: [
126121
new WebpackAssetsManifest({
@@ -131,4 +126,4 @@ const prod = merge({}, config, {
131126
],
132127
});
133128

134-
module.exports = { umd, esm, prod };
129+
module.exports = [umd, esm, prod];

0 commit comments

Comments
 (0)