|
1 |
| -const webpack = require('webpack'); |
2 |
| -const TerserPlugin = require('terser-webpack-plugin'); |
3 | 1 | const pkg = require('./package.json');
|
4 | 2 |
|
5 | 3 | const comment = `/*! @${pkg.author}/${pkg.name} version:${pkg.version} repository:${pkg.repository.url} copyright:${pkg.author} licensed:${pkg.license} */`;
|
6 | 4 |
|
7 | 5 | const env = process.env.NODE_ENV;
|
8 | 6 |
|
| 7 | +if(!env) process.exit(1); |
| 8 | + |
| 9 | +const webpack = require('webpack'); |
| 10 | +const TerserPlugin = require('terser-webpack-plugin'); |
| 11 | + |
9 | 12 | const webpackPlugEnv = new webpack.EnvironmentPlugin({
|
10 |
| - NODE_ENV: 'development', |
11 | 13 | VERSION: pkg.version,
|
12 | 14 | DEBUG: false
|
13 | 15 | });
|
14 | 16 |
|
15 |
| -const babelPlugin = [ |
16 |
| - '@babel/plugin-transform-object-assign' |
17 |
| -]; |
18 |
| - |
19 | 17 | const config = {
|
20 |
| - mode: env || 'development', |
| 18 | + mode: env, |
21 | 19 | entry: {
|
22 |
| - 'js-player-module-brightcove': './src/js-player-module-brightcove.js', |
| 20 | + 'js-player-module-brightcove': './src/js-player-module-brightcove.ts', |
23 | 21 | },
|
24 | 22 | output: {
|
25 | 23 | path: `${__dirname}/dist`,
|
26 | 24 | filename: '[name].js',
|
27 |
| - libraryTarget: 'umd' |
| 25 | + library: { |
| 26 | + name: 'PLAYER_MODULE_BRIGHTCOVE', |
| 27 | + type: 'umd', |
| 28 | + export: 'PLAYER_MODULE_BRIGHTCOVE', |
| 29 | + } |
28 | 30 | },
|
29 | 31 | module: {
|
30 | 32 | rules: [
|
31 | 33 | {
|
32 |
| - enforce: 'pre', |
33 |
| - test: /\.(js)$/, |
34 |
| - exclude: /node_modules/, |
35 |
| - loader: 'eslint-loader', |
| 34 | + test: /\.ts$/, |
| 35 | + use: 'ts-loader', |
36 | 36 | },
|
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 | + ], |
58 | 43 | },
|
59 | 44 | plugins: [
|
60 | 45 | webpackPlugEnv
|
|
0 commit comments