UNPKG

@expo/webpack-config

Version:

The default Webpack configuration used to build Expo apps targeting the web.

32 lines 1.84 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const InterpolateHtmlPlugin_1 = __importDefault(require("react-dev-utils/InterpolateHtmlPlugin")); const env_1 = require("../env"); function createNoJSComponent(message) { // from twitter.com return `" <form action="location.reload()" method="POST" style="background-color:#fff;position:fixed;top:0;left:0;right:0;bottom:0;z-index:9999;"><div style="font-size:18px;font-family:Helvetica,sans-serif;line-height:24px;margin:10%;width:80%;"> <p>${message}</p> <p style="margin:20px 0;"> <button type="submit" style="background-color: #4630EB; border-radius: 100px; border: none; box-shadow: none; color: #fff; cursor: pointer; font-weight: bold; line-height: 20px; padding: 6px 16px;">Reload</button> </p> </div> </form> "`; } exports.createNoJSComponent = createNoJSComponent; class ExpoInterpolateHtmlPlugin extends InterpolateHtmlPlugin_1.default { } exports.default = ExpoInterpolateHtmlPlugin; ExpoInterpolateHtmlPlugin.fromEnv = (env, HtmlWebpackPlugin) => { const config = env.config || env_1.getConfig(env); const { publicPath } = env_1.getPublicPaths(env); const { build: buildConfig = {}, lang } = config.web; const { rootId } = buildConfig; const { noJavaScriptMessage } = config.web.dangerous; const noJSComponent = createNoJSComponent(noJavaScriptMessage); // Add variables to the `index.html` return new ExpoInterpolateHtmlPlugin(HtmlWebpackPlugin, { WEB_PUBLIC_URL: publicPath, WEB_TITLE: config.web.name, NO_SCRIPT: noJSComponent, LANG_ISO_CODE: lang, ROOT_ID: rootId, }); }; //# sourceMappingURL=ExpoInterpolateHtmlPlugin.js.map