1 | "use strict";
|
2 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
3 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
4 | };
|
5 | Object.defineProperty(exports, "__esModule", { value: true });
|
6 | const paths_1 = require("@expo/config/paths");
|
7 | const addons_1 = require("./addons");
|
8 | const env_1 = require("./env");
|
9 | const webpack_config_1 = __importDefault(require("./webpack.config"));
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | async function createWebpackConfigAsync(env = {}, argv = {}) {
|
18 | if (!env.projectRoot) {
|
19 | env.projectRoot = paths_1.getPossibleProjectRoot();
|
20 | }
|
21 | if (!env.platform) {
|
22 |
|
23 | env.platform = process.env.EXPO_WEBPACK_PLATFORM;
|
24 | }
|
25 | const environment = env_1.validateEnvironment(env);
|
26 | const config = await webpack_config_1.default(environment, argv);
|
27 |
|
28 | if (environment.info) {
|
29 | console.warn('environment.info is deprecated');
|
30 | }
|
31 | if (environment.offline === false) {
|
32 | return config;
|
33 | }
|
34 | const { workbox = {} } = argv;
|
35 | const publicUrl = workbox.publicUrl || env_1.getPublicPaths(environment).publicUrl;
|
36 |
|
37 | if (['ios', 'android'].includes(env.platform || '')) {
|
38 | return config;
|
39 | }
|
40 | return addons_1.withWorkbox(config, Object.assign(Object.assign({ projectRoot: environment.projectRoot }, workbox), { publicUrl, platform: env.platform }));
|
41 | }
|
42 | exports.default = createWebpackConfigAsync;
|
43 |
|
\ | No newline at end of file |