forked from freee/firebase-sdk-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
41 lines (40 loc) · 1.02 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const nodeExternals = require('webpack-node-externals')
const CopyPlugin = require('copy-webpack-plugin')
module.exports = {
// メインとなるJavaScriptファイル(エントリーポイント)
entry: './src/index.ts',
// ファイルの出力設定
output: {
// 出力ファイルのディレクトリ名
path: `${__dirname}/lib`,
// 出力ファイル名
filename: 'index.js',
libraryTarget: 'this'
},
target: 'node',
devtool: 'cheap-module-source-map',
mode: 'development',
module: {
rules: [
{
// 拡張子 .ts もしくは .tsx の場合
test: /\.tsx?$/,
// TypeScript をコンパイルする
use: 'ts-loader'
}
]
},
// import 文で .ts や .tsx ファイルを解決するため
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json']
},
externalsPresets: { node: true },
externals: [nodeExternals()],
plugins: [
new CopyPlugin({
patterns: [
{ from: 'typings', to: './' },
],
}),
],
}