webpack.config.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. /* eslint-env node */
  2. /* eslint import/no-nodejs-modules:0 */
  3. const fs = require('fs');
  4. const path = require('path');
  5. const {CleanWebpackPlugin} = require('clean-webpack-plugin'); // installed via npm
  6. const {WebpackManifestPlugin} = require('webpack-manifest-plugin');
  7. const webpack = require('webpack');
  8. const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
  9. const MiniCssExtractPlugin = require('mini-css-extract-plugin');
  10. const CompressionPlugin = require('compression-webpack-plugin');
  11. const FixStyleOnlyEntriesPlugin = require('webpack-remove-empty-scripts');
  12. const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
  13. const IntegrationDocsFetchPlugin = require('./build-utils/integration-docs-fetch-plugin');
  14. const SentryInstrumentation = require('./build-utils/sentry-instrumentation');
  15. const LastBuiltPlugin = require('./build-utils/last-built-plugin');
  16. const babelConfig = require('./babel.config');
  17. const {env} = process;
  18. /**
  19. * Environment configuration
  20. */
  21. const IS_PRODUCTION = env.NODE_ENV === 'production';
  22. const IS_TEST = env.NODE_ENV === 'test' || env.TEST_SUITE;
  23. const IS_STORYBOOK = env.STORYBOOK_BUILD === '1';
  24. // This is used to stop rendering dynamic content for tests/snapshots
  25. // We want it in the case where we are running tests and it is in CI,
  26. // this should not happen in local
  27. const IS_CI = !!env.CI;
  28. // We intentionally build in production mode for acceptance tests, so we explicitly use an env var to
  29. // say that the bundle will be used in acceptance tests. This affects webpack plugins and components
  30. // with dynamic data that render differently statically in tests.
  31. //
  32. // Note, cannot assume it is an acceptance test if `IS_CI` is true, as our image builds has the
  33. // `CI` env var set.
  34. const IS_ACCEPTANCE_TEST = !!env.IS_ACCEPTANCE_TEST;
  35. const IS_DEPLOY_PREVIEW = !!env.NOW_GITHUB_DEPLOYMENT;
  36. const IS_UI_DEV_ONLY = !!env.SENTRY_UI_DEV_ONLY;
  37. const DEV_MODE = !(IS_PRODUCTION || IS_CI);
  38. const WEBPACK_MODE = IS_PRODUCTION ? 'production' : 'development';
  39. /**
  40. * Environment variables that are used by other tooling and should
  41. * not be user configurable.
  42. */
  43. // Ports used by webpack dev server to proxy to backend and webpack
  44. const SENTRY_BACKEND_PORT = env.SENTRY_BACKEND_PORT;
  45. const SENTRY_WEBPACK_PROXY_HOST = env.SENTRY_WEBPACK_PROXY_HOST;
  46. const SENTRY_WEBPACK_PROXY_PORT = env.SENTRY_WEBPACK_PROXY_PORT;
  47. // Used by sentry devserver runner to force using webpack-dev-server
  48. const FORCE_WEBPACK_DEV_SERVER = !!env.FORCE_WEBPACK_DEV_SERVER;
  49. const HAS_WEBPACK_DEV_SERVER_CONFIG = SENTRY_BACKEND_PORT && SENTRY_WEBPACK_PROXY_PORT;
  50. /**
  51. * User/tooling configurable environment variables
  52. */
  53. const NO_DEV_SERVER = !!env.NO_DEV_SERVER; // Do not run webpack dev server
  54. const SHOULD_FORK_TS = DEV_MODE && !env.NO_TS_FORK; // Do not run fork-ts plugin (or if not dev env)
  55. const SHOULD_HOT_MODULE_RELOAD = DEV_MODE && !!env.SENTRY_UI_HOT_RELOAD;
  56. // Deploy previews are built using zeit. We can check if we're in zeit's
  57. // build process by checking the existence of the PULL_REQUEST env var.
  58. const DEPLOY_PREVIEW_CONFIG = IS_DEPLOY_PREVIEW && {
  59. branch: env.NOW_GITHUB_COMMIT_REF,
  60. commitSha: env.NOW_GITHUB_COMMIT_SHA,
  61. githubOrg: env.NOW_GITHUB_COMMIT_ORG,
  62. githubRepo: env.NOW_GITHUB_COMMIT_REPO,
  63. };
  64. // When deploy previews are enabled always enable experimental SPA mode --
  65. // deploy previews are served standalone. Otherwise fallback to the environment
  66. // configuration.
  67. const SENTRY_EXPERIMENTAL_SPA =
  68. !DEPLOY_PREVIEW_CONFIG && !IS_UI_DEV_ONLY ? env.SENTRY_EXPERIMENTAL_SPA : true;
  69. // We should only read from the SENTRY_SPA_DSN env variable if SENTRY_EXPERIMENTAL_SPA
  70. // is true. This is to make sure we can validate that the experimental SPA mode is
  71. // working properly.
  72. const SENTRY_SPA_DSN = SENTRY_EXPERIMENTAL_SPA ? env.SENTRY_SPA_DSN : undefined;
  73. // this is the path to the django "sentry" app, we output the webpack build here to `dist`
  74. // so that `django collectstatic` and so that we can serve the post-webpack bundles
  75. const sentryDjangoAppPath = path.join(__dirname, 'src/sentry/static/sentry');
  76. const distPath = env.SENTRY_STATIC_DIST_PATH || path.join(sentryDjangoAppPath, 'dist');
  77. const staticPrefix = path.join(__dirname, 'static');
  78. /**
  79. * Locale file extraction build step
  80. */
  81. if (env.SENTRY_EXTRACT_TRANSLATIONS === '1') {
  82. babelConfig.plugins.push([
  83. 'module:babel-gettext-extractor',
  84. {
  85. fileName: 'build/javascript.po',
  86. baseDirectory: path.join(__dirname, 'src/sentry'),
  87. functionNames: {
  88. gettext: ['msgid'],
  89. ngettext: ['msgid', 'msgid_plural', 'count'],
  90. gettextComponentTemplate: ['msgid'],
  91. t: ['msgid'],
  92. tn: ['msgid', 'msgid_plural', 'count'],
  93. tct: ['msgid'],
  94. },
  95. },
  96. ]);
  97. }
  98. /**
  99. * Locale compilation and optimizations.
  100. *
  101. * Locales are code-split from the app and vendor chunk into separate chunks
  102. * that will be loaded by layout.html depending on the users configured locale.
  103. *
  104. * Code splitting happens using the splitChunks plugin, configured under the
  105. * `optimization` key of the webpack module. We create chunk (cache) groups for
  106. * each of our supported locales and extract the PO files and moment.js locale
  107. * files into each chunk.
  108. *
  109. * A plugin is used to remove the locale chunks from the app entry's chunk
  110. * dependency list, so that our compiled bundle does not expect that *all*
  111. * locale chunks must be loaded
  112. */
  113. const localeCatalogPath = path.join(
  114. __dirname,
  115. 'src',
  116. 'sentry',
  117. 'locale',
  118. 'catalogs.json'
  119. );
  120. const localeCatalog = JSON.parse(fs.readFileSync(localeCatalogPath, 'utf8'));
  121. // Translates a locale name to a language code.
  122. //
  123. // * po files are kept in a directory represented by the locale name [0]
  124. // * moment.js locales are stored as language code files
  125. //
  126. // [0] https://docs.djangoproject.com/en/2.1/topics/i18n/#term-locale-name
  127. const localeToLanguage = locale => locale.toLowerCase().replace('_', '-');
  128. const supportedLocales = localeCatalog.supported_locales;
  129. const supportedLanguages = supportedLocales.map(localeToLanguage);
  130. // A mapping of chunk groups used for locale code splitting
  131. const localeChunkGroups = {};
  132. supportedLocales
  133. // No need to split the english locale out as it will be completely empty and
  134. // is not included in the django layout.html.
  135. .filter(l => l !== 'en')
  136. .forEach(locale => {
  137. const language = localeToLanguage(locale);
  138. const group = `locale/${language}`;
  139. // List of module path tests to group into locale chunks
  140. const localeGroupTests = [
  141. new RegExp(`locale\\/${locale}\\/.*\\.po$`),
  142. new RegExp(`moment\\/locale\\/${language}\\.js$`),
  143. ];
  144. // module test taken from [0] and modified to support testing against
  145. // multiple expressions.
  146. //
  147. // [0] https://github.com/webpack/webpack/blob/7a6a71f1e9349f86833de12a673805621f0fc6f6/lib/optimize/SplitChunksPlugin.js#L309-L320
  148. const groupTest = (module, {chunkGraph}) =>
  149. localeGroupTests.some(pattern =>
  150. module.nameForCondition && pattern.test(module.nameForCondition())
  151. ? true
  152. : chunkGraph.getModuleChunks(module).some(c => c.name && pattern.test(c.name))
  153. );
  154. // We are defining a chunk that combines the django language files with
  155. // moment's locales as if you want one, you will want the other.
  156. //
  157. // In the application code you will still need to import via their module
  158. // paths and not the chunk name
  159. localeChunkGroups[group] = {
  160. chunks: 'async',
  161. name: group,
  162. test: groupTest,
  163. enforce: true,
  164. };
  165. });
  166. const babelOptions = {...babelConfig, cacheDirectory: true};
  167. const babelLoaderConfig = {
  168. loader: 'babel-loader',
  169. options: babelOptions,
  170. };
  171. /**
  172. * Main Webpack config for Sentry React SPA.
  173. */
  174. let appConfig = {
  175. mode: WEBPACK_MODE,
  176. entry: {
  177. /**
  178. * Main Sentry SPA
  179. *
  180. * The order here matters for `getsentry`
  181. */
  182. app: ['app/utils/statics-setup', 'app'],
  183. /**
  184. * Pipeline View for integrations
  185. */
  186. pipeline: ['app/utils/statics-setup', 'app/views/integrationPipeline'],
  187. /**
  188. * Legacy CSS Webpack appConfig for Django-powered views.
  189. * This generates a single "sentry.css" file that imports ALL component styles
  190. * for use on Django-powered pages.
  191. */
  192. sentry: 'less/sentry.less',
  193. },
  194. context: staticPrefix,
  195. module: {
  196. /**
  197. * XXX: Modifying the order/contents of these rules may break `getsentry`
  198. * Please remember to test it.
  199. */
  200. rules: [
  201. {
  202. test: /\.[tj]sx?$/,
  203. include: [staticPrefix],
  204. exclude: /(vendor|node_modules|dist)/,
  205. use: babelLoaderConfig,
  206. },
  207. {
  208. test: /\.po$/,
  209. use: {
  210. loader: 'po-catalog-loader',
  211. options: {
  212. referenceExtensions: ['.js', '.jsx'],
  213. domain: 'sentry',
  214. },
  215. },
  216. },
  217. {
  218. test: /\.pegjs/,
  219. use: {loader: 'pegjs-loader'},
  220. },
  221. {
  222. test: /\.css/,
  223. use: ['style-loader', 'css-loader'],
  224. },
  225. {
  226. test: /\.less$/,
  227. include: [staticPrefix],
  228. use: [MiniCssExtractPlugin.loader, 'css-loader', 'less-loader'],
  229. },
  230. {
  231. test: /\.(woff|woff2|ttf|eot|svg|png|gif|ico|jpg|mp4)($|\?)/,
  232. use: [
  233. {
  234. loader: 'file-loader',
  235. options: {
  236. // This needs to be `false` because of platformicons package
  237. esModule: false,
  238. name: '[folder]/[name].[contenthash:6].[ext]',
  239. },
  240. },
  241. ],
  242. },
  243. ],
  244. noParse: [
  245. // don't parse known, pre-built javascript files (improves webpack perf)
  246. /dist\/jquery\.js/,
  247. /jed\/jed\.js/,
  248. /marked\/lib\/marked\.js/,
  249. /terser\/dist\/bundle\.min\.js/,
  250. ],
  251. },
  252. plugins: [
  253. new CleanWebpackPlugin(),
  254. new WebpackManifestPlugin({}),
  255. // Do not bundle moment's locale files as we will lazy load them using
  256. // dynamic imports in the application code
  257. new webpack.IgnorePlugin({
  258. contextRegExp: /moment$/,
  259. resourceRegExp: /^\.\/locale$/,
  260. }),
  261. /**
  262. * jQuery must be provided in the global scope specifically and only for
  263. * bootstrap, as it will not import jQuery itself.
  264. *
  265. * We discourage the use of global jQuery through eslint rules
  266. */
  267. new webpack.ProvidePlugin({
  268. jQuery: 'jquery',
  269. process: 'process/browser',
  270. Buffer: ['buffer', 'Buffer'],
  271. }),
  272. /**
  273. * Extract CSS into separate files.
  274. */
  275. new MiniCssExtractPlugin({
  276. filename: '[name].[contenthash:6].css',
  277. }),
  278. /**
  279. * Defines environment specific flags.
  280. */
  281. new webpack.DefinePlugin({
  282. 'process.env': {
  283. NODE_ENV: JSON.stringify(env.NODE_ENV),
  284. IS_ACCEPTANCE_TEST: JSON.stringify(IS_ACCEPTANCE_TEST),
  285. DEPLOY_PREVIEW_CONFIG: JSON.stringify(DEPLOY_PREVIEW_CONFIG),
  286. EXPERIMENTAL_SPA: JSON.stringify(SENTRY_EXPERIMENTAL_SPA),
  287. SPA_DSN: JSON.stringify(SENTRY_SPA_DSN),
  288. },
  289. }),
  290. /**
  291. * This removes empty js files for style only entries (e.g. sentry.less)
  292. */
  293. new FixStyleOnlyEntriesPlugin({verbose: false}),
  294. new SentryInstrumentation(),
  295. ...(SHOULD_FORK_TS
  296. ? [
  297. new ForkTsCheckerWebpackPlugin({
  298. typescript: {
  299. configFile: path.resolve(__dirname, './config/tsconfig.build.json'),
  300. configOverwrite: {
  301. compilerOptions: {incremental: true},
  302. },
  303. },
  304. }),
  305. ]
  306. : []),
  307. /**
  308. * Restrict translation files that are pulled in through app/translations.jsx
  309. * and through moment/locale/* to only those which we create bundles for via
  310. * locale/catalogs.json.
  311. *
  312. * Without this, webpack will still output all of the unused locale files despite
  313. * the application never loading any of them.
  314. */
  315. new webpack.ContextReplacementPlugin(
  316. /sentry-locale$/,
  317. path.join(__dirname, 'src', 'sentry', 'locale', path.sep),
  318. true,
  319. new RegExp(`(${supportedLocales.join('|')})/.*\\.po$`)
  320. ),
  321. new webpack.ContextReplacementPlugin(
  322. /moment\/locale/,
  323. new RegExp(`(${supportedLanguages.join('|')})\\.js$`)
  324. ),
  325. ],
  326. resolve: {
  327. alias: {
  328. app: path.join(staticPrefix, 'app'),
  329. 'sentry-images': path.join(staticPrefix, 'images'),
  330. 'sentry-logos': path.join(sentryDjangoAppPath, 'images', 'logos'),
  331. 'sentry-fonts': path.join(staticPrefix, 'fonts'),
  332. // Aliasing this for getsentry's build, otherwise `less/select2` will not be able
  333. // to be resolved
  334. less: path.join(staticPrefix, 'less'),
  335. 'sentry-test': path.join(__dirname, 'tests', 'js', 'sentry-test'),
  336. 'sentry-locale': path.join(__dirname, 'src', 'sentry', 'locale'),
  337. 'ios-device-list': path.join(
  338. __dirname,
  339. 'node_modules',
  340. 'ios-device-list',
  341. 'dist',
  342. 'ios-device-list.min.js'
  343. ),
  344. },
  345. fallback: {
  346. vm: false,
  347. stream: false,
  348. crypto: require.resolve('crypto-browserify'),
  349. // `yarn why` says this is only needed in dev deps
  350. string_decoder: false,
  351. },
  352. modules: ['node_modules'],
  353. extensions: ['.jsx', '.js', '.json', '.ts', '.tsx', '.less'],
  354. },
  355. output: {
  356. path: distPath,
  357. publicPath: '',
  358. filename: '[name].[contenthash].js',
  359. chunkFilename: 'chunks/[name].[contenthash].js',
  360. sourceMapFilename: 'sourcemaps/[name].[contenthash].js.map',
  361. },
  362. optimization: {
  363. chunkIds: 'named',
  364. moduleIds: 'named',
  365. runtimeChunk: {name: 'runtime'},
  366. splitChunks: {
  367. // Only affect async chunks, otherwise webpack could potentially split our initial chunks
  368. // Which means the app will not load because we'd need these additional chunks to be loaded in our
  369. // django template.
  370. chunks: 'async',
  371. maxInitialRequests: 10, // (default: 30)
  372. maxAsyncRequests: 10, // (default: 30)
  373. cacheGroups: {
  374. ...localeChunkGroups,
  375. },
  376. },
  377. // This only runs in production mode
  378. // Grabbed this example from https://github.com/webpack-contrib/css-minimizer-webpack-plugin
  379. minimizer: ['...', new CssMinimizerPlugin()],
  380. },
  381. devtool: IS_PRODUCTION ? 'source-map' : 'eval-cheap-module-source-map',
  382. };
  383. if (IS_TEST || IS_ACCEPTANCE_TEST || IS_STORYBOOK) {
  384. appConfig.resolve.alias['integration-docs-platforms'] = path.join(
  385. __dirname,
  386. 'tests/fixtures/integration-docs/_platforms.json'
  387. );
  388. } else {
  389. const plugin = new IntegrationDocsFetchPlugin({basePath: __dirname});
  390. appConfig.plugins.push(plugin);
  391. appConfig.resolve.alias['integration-docs-platforms'] = plugin.modulePath;
  392. }
  393. if (IS_ACCEPTANCE_TEST) {
  394. appConfig.plugins.push(new LastBuiltPlugin({basePath: __dirname}));
  395. }
  396. // Dev only! Hot module reloading
  397. if (
  398. FORCE_WEBPACK_DEV_SERVER ||
  399. (HAS_WEBPACK_DEV_SERVER_CONFIG && !NO_DEV_SERVER) ||
  400. IS_UI_DEV_ONLY
  401. ) {
  402. if (SHOULD_HOT_MODULE_RELOAD) {
  403. // Hot reload react components on save
  404. // We include the library here as to not break docker/google cloud builds
  405. // since we do not install devDeps there.
  406. const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
  407. appConfig.plugins.push(new ReactRefreshWebpackPlugin());
  408. }
  409. appConfig.devServer = {
  410. headers: {
  411. 'Access-Control-Allow-Origin': '*',
  412. 'Access-Control-Allow-Credentials': 'true',
  413. },
  414. // Required for getsentry
  415. disableHostCheck: true,
  416. contentBase: './src/sentry/static/sentry',
  417. host: SENTRY_WEBPACK_PROXY_HOST,
  418. hot: true,
  419. // If below is false, will reload on errors
  420. hotOnly: true,
  421. port: SENTRY_WEBPACK_PROXY_PORT,
  422. stats: 'errors-only',
  423. overlay: false,
  424. watchOptions: {
  425. ignored: ['node_modules'],
  426. },
  427. };
  428. if (!IS_UI_DEV_ONLY) {
  429. // This proxies to local backend server
  430. const backendAddress = `http://localhost:${SENTRY_BACKEND_PORT}/`;
  431. const relayAddress = 'http://127.0.0.1:7899';
  432. appConfig.devServer = {
  433. ...appConfig.devServer,
  434. publicPath: '/_static/dist/sentry',
  435. // syntax for matching is using https://www.npmjs.com/package/micromatch
  436. proxy: {
  437. '/api/store/**': relayAddress,
  438. '/api/{1..9}*({0..9})/**': relayAddress,
  439. '/api/0/relays/outcomes/': relayAddress,
  440. '!/_static/dist/sentry/**': backendAddress,
  441. },
  442. writeToDisk: filePath => {
  443. return /manifest\.json/.test(filePath);
  444. },
  445. };
  446. }
  447. }
  448. // XXX(epurkhiser): Sentry (development) can be run in an experimental
  449. // pure-SPA mode, where ONLY /api* requests are proxied directly to the API
  450. // backend (in this case, sentry.io), otherwise ALL requests are rewritten
  451. // to a development index.html -- thus, completely separating the frontend
  452. // from serving any pages through the backend.
  453. //
  454. // THIS IS EXPERIMENTAL and has limitations (e.g. you can't use SSO)
  455. //
  456. // Various sentry pages still rely on django to serve html views.
  457. if (IS_UI_DEV_ONLY) {
  458. appConfig.devServer = {
  459. ...appConfig.devServer,
  460. compress: true,
  461. https: true,
  462. publicPath: '/_assets/',
  463. proxy: [
  464. {
  465. context: ['/api/', '/avatar/', '/organization-avatar/'],
  466. target: 'https://sentry.io',
  467. secure: false,
  468. changeOrigin: true,
  469. headers: {
  470. Referer: 'https://sentry.io/',
  471. },
  472. },
  473. ],
  474. historyApiFallback: {
  475. rewrites: [{from: /^\/.*$/, to: '/_assets/index.html'}],
  476. },
  477. };
  478. }
  479. if (IS_UI_DEV_ONLY || IS_DEPLOY_PREVIEW) {
  480. appConfig.output.publicPath = '/_assets/';
  481. /**
  482. * Generate a index.html file used for running the app in pure client mode.
  483. * This is currently used for PR deploy previews, where only the frontend
  484. * is deployed.
  485. */
  486. const HtmlWebpackPlugin = require('html-webpack-plugin');
  487. appConfig.plugins.push(
  488. new HtmlWebpackPlugin({
  489. // Local dev vs vercel slightly differs...
  490. ...(IS_UI_DEV_ONLY
  491. ? {devServer: `https://localhost:${SENTRY_WEBPACK_PROXY_PORT}`}
  492. : {}),
  493. favicon: path.resolve(sentryDjangoAppPath, 'images', 'favicon_dev.png'),
  494. template: path.resolve(staticPrefix, 'index.ejs'),
  495. mobile: true,
  496. excludeChunks: ['pipeline'],
  497. title: 'Sentry',
  498. })
  499. );
  500. }
  501. const minificationPlugins = [
  502. // This compression-webpack-plugin generates pre-compressed files
  503. // ending in .gz, to be picked up and served by our internal static media
  504. // server as well as nginx when paired with the gzip_static module.
  505. new CompressionPlugin({
  506. algorithm: 'gzip',
  507. test: /\.(js|map|css|svg|html|txt|ico|eot|ttf)$/,
  508. }),
  509. // NOTE: In production mode webpack will automatically minify javascript
  510. // using the TerserWebpackPlugin.
  511. ];
  512. if (IS_PRODUCTION) {
  513. // NOTE: can't do plugins.push(Array) because webpack/webpack#2217
  514. minificationPlugins.forEach(function (plugin) {
  515. appConfig.plugins.push(plugin);
  516. });
  517. }
  518. // Cache webpack builds
  519. if (env.WEBPACK_CACHE_PATH) {
  520. appConfig.cache = {
  521. type: 'filesystem',
  522. cacheLocation: path.resolve(__dirname, env.WEBPACK_CACHE_PATH),
  523. buildDependencies: {
  524. // This makes all dependencies of this file - build dependencies
  525. config: [__filename],
  526. // By default webpack and loaders are build dependencies
  527. },
  528. };
  529. }
  530. if (env.MEASURE) {
  531. const SpeedMeasurePlugin = require('speed-measure-webpack-plugin');
  532. const smp = new SpeedMeasurePlugin();
  533. appConfig = smp.wrap(appConfig);
  534. }
  535. module.exports = appConfig;