|
|
|
@@ -6,9 +6,13 @@ const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); |
|
|
|
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); |
|
|
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; |
|
|
|
const Dotenv = require('dotenv-webpack'); |
|
|
|
const dotenv = require('dotenv'); |
|
|
|
const { format } = require('date-fns'); |
|
|
|
|
|
|
|
const basePath = path.resolve('src', 'apps'); |
|
|
|
|
|
|
|
const env = dotenv.config().parsed |
|
|
|
|
|
|
|
// basePath配下の各ディレクトリを複数のentryとする |
|
|
|
const entries = glob.sync('**/index.+(js|ts|tsx)', { cwd: basePath }).reduce( |
|
|
|
(prev, file) => ({ |
|
|
|
@@ -63,7 +67,7 @@ module.exports = { |
|
|
|
filename: '[name].js', |
|
|
|
}, |
|
|
|
plugins: [ |
|
|
|
new Dotenv({ systemvars: true }), |
|
|
|
// new Dotenv({ systemvars: true }), |
|
|
|
new ForkTsCheckerWebpackPlugin(), |
|
|
|
// new BundleAnalyzerPlugin(), |
|
|
|
{ |
|
|
|
@@ -100,11 +104,10 @@ module.exports = { |
|
|
|
); |
|
|
|
}, |
|
|
|
}, |
|
|
|
// new webpack.DefinePlugin({ |
|
|
|
// 'process.env': { |
|
|
|
// "MYPAGE_BASE_URL": JSON.stringify(process.env.MYPAGE_BASE_URL), |
|
|
|
// "MYPAGE_TOKEN": JSON.stringify(process.env.MYPAGE_TOKEN), |
|
|
|
// } |
|
|
|
// }), |
|
|
|
new webpack.DefinePlugin({ |
|
|
|
'process.env.VAR': JSON.stringify(env), |
|
|
|
'process.env.BUILD_TIME': JSON.stringify(format(new Date(), 'yyyy-MM-dd HH:mm:ss')), |
|
|
|
|
|
|
|
}), |
|
|
|
], |
|
|
|
}; |