Skip to content

Commit 5c144fe

Browse files
committed
adjust webpack config
1 parent 37e097b commit 5c144fe

File tree

1 file changed

+20
-35
lines changed

1 file changed

+20
-35
lines changed

webpack.config.js

Lines changed: 20 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,45 @@
1-
const webpack = require('webpack');
2-
const TerserPlugin = require('terser-webpack-plugin');
31
const pkg = require('./package.json');
42

53
const comment = `/*! @${pkg.author}/${pkg.name} version:${pkg.version} repository:${pkg.repository.url} copyright:${pkg.author} licensed:${pkg.license} */`;
64

75
const env = process.env.NODE_ENV;
86

7+
if(!env) process.exit(1);
8+
9+
const webpack = require('webpack');
10+
const TerserPlugin = require('terser-webpack-plugin');
11+
912
const webpackPlugEnv = new webpack.EnvironmentPlugin({
10-
NODE_ENV: 'development',
1113
VERSION: pkg.version,
1214
DEBUG: false
1315
});
1416

15-
const babelPlugin = [
16-
'@babel/plugin-transform-object-assign'
17-
];
18-
1917
const config = {
20-
mode: env || 'development',
18+
mode: env,
2119
entry: {
22-
'js-player-module-brightcove': './src/js-player-module-brightcove.js',
20+
'js-player-module-brightcove': './src/js-player-module-brightcove.ts',
2321
},
2422
output: {
2523
path: `${__dirname}/dist`,
2624
filename: '[name].js',
27-
libraryTarget: 'umd'
25+
library: {
26+
name: 'PLAYER_MODULE_BRIGHTCOVE',
27+
type: 'umd',
28+
export: 'PLAYER_MODULE_BRIGHTCOVE',
29+
}
2830
},
2931
module: {
3032
rules: [
3133
{
32-
enforce: 'pre',
33-
test: /\.(js)$/,
34-
exclude: /node_modules/,
35-
loader: 'eslint-loader',
34+
test: /\.ts$/,
35+
use: 'ts-loader',
3636
},
37-
{
38-
test: /\.js$/,
39-
exclude: /node_modules[//\/](?!(@yama\-dev)\/).*/,
40-
use: [
41-
{
42-
loader: 'babel-loader',
43-
options: {
44-
presets: [
45-
[
46-
'@babel/preset-env',
47-
{
48-
modules: false
49-
}
50-
]
51-
],
52-
plugins: babelPlugin
53-
}
54-
}
55-
],
56-
}
57-
]
37+
],
38+
},
39+
resolve: {
40+
extensions: [
41+
'.ts', '.js',
42+
],
5843
},
5944
plugins: [
6045
webpackPlugEnv

0 commit comments

Comments
 (0)