|
1 | | -const path = require('path'); |
2 | | -const fs = require('fs'); |
| 1 | +const path = require("path"); |
| 2 | +const fs = require("fs"); |
3 | 3 |
|
4 | 4 | const currentWorkingDirectory = __dirname; |
5 | 5 |
|
6 | | -const configPromise = new Promise(function (resolve, reject) { |
7 | | - |
| 6 | +const configPromise = new Promise(function(resolve, reject) { |
8 | 7 | // read the webpack dependency externals config from a separate JSON file |
9 | | - fs.readFile('dependency-externals.json', 'utf8', (err, externalsData) => { |
| 8 | + fs.readFile("dependency-externals.json", "utf8", (err, externalsData) => { |
10 | 9 | if (err) { |
11 | | - reject(`Unable to read './dependency-externals.json' file. Reason: ${err}`); |
| 10 | + reject( |
| 11 | + `Unable to read './dependency-externals.json' file. Reason: ${err}` |
| 12 | + ); |
12 | 13 | } |
13 | 14 |
|
14 | 15 | let externalsConfig = {}; |
15 | 16 | try { |
16 | 17 | externalsConfig = JSON.parse(externalsData); |
17 | | - } |
18 | | - catch (e) { |
19 | | - reject(`Unable to convert './dependency-externals.json' file data to JSON object. Reason: ${e}`); |
| 18 | + } catch (e) { |
| 19 | + reject( |
| 20 | + `Unable to convert './dependency-externals.json' file data to JSON object. Reason: ${e}` |
| 21 | + ); |
20 | 22 | } |
21 | 23 |
|
22 | 24 | const webpackConfig = { |
23 | | - entry: path.resolve(currentWorkingDirectory, 'src/index.ts'), |
24 | | - mode: 'production', |
| 25 | + entry: path.resolve(currentWorkingDirectory, "src/index.ts"), |
| 26 | + mode: "production", |
25 | 27 | module: { |
26 | 28 | rules: [ |
27 | 29 | { |
28 | 30 | test: /\.tsx?$/, |
29 | | - use: 'ts-loader', |
| 31 | + use: [ |
| 32 | + { |
| 33 | + loader: "ts-loader", |
| 34 | + options: { |
| 35 | + configFile: "tsconfig.dist.json", |
| 36 | + }, |
| 37 | + }, |
| 38 | + ], |
30 | 39 | exclude: /node_modules/, |
31 | 40 | }, |
32 | 41 | ], |
33 | 42 | }, |
34 | 43 | output: { |
35 | | - path: path.resolve(__dirname, 'dist-global'), |
36 | | - filename: 'index.js', |
37 | | - library: 'AndcultureCode', |
38 | | - libraryTarget: 'umd', |
| 44 | + path: path.resolve(__dirname, "dist-global"), |
| 45 | + filename: "index.js", |
| 46 | + library: "AndcultureCode", |
| 47 | + libraryTarget: "umd", |
39 | 48 | }, |
40 | 49 | resolve: { |
41 | | - extensions: ['.ts', '.js'], |
| 50 | + extensions: [".ts", ".js"], |
42 | 51 | }, |
43 | 52 | }; |
44 | 53 |
|
|
0 commit comments