Advertisement
zhirzh

Untitled

Feb 17th, 2018
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 19.25 KB | None | 0 0
  1. git log -p config/webpack.config.dev.js
  2. commit c96d860be6ad0f13d478af4b540ce2812d589e79
  3. Author: Dominik Moritz <domoritz@gmail.com>
  4. Date:   Wed Oct 18 19:41:45 2017 -0700
  5.  
  6.     Fix build
  7.  
  8. diff --git a/config/webpack.config.dev.js b/config/webpack.config.dev.js
  9. index 71197f4..13dbd07 100644
  10. --- a/config/webpack.config.dev.js
  11. +++ b/config/webpack.config.dev.js
  12. @@ -226,5 +226,8 @@ module.exports = {
  13.      fs: 'empty',
  14.      net: 'empty',
  15.      tls: 'empty'
  16. -  }
  17. +  },
  18. +  externals:[{
  19. +    xmlhttprequest: '{XMLHttpRequest:XMLHttpRequest}'
  20. +  }]
  21.  };
  22.  
  23. commit f948d5e324ae1116f079af2befad00cf7ec6e7f9
  24. Author: Dominik Moritz <domoritz@gmail.com>
  25. Date:   Thu Jul 13 14:54:40 2017 -0700
  26.  
  27.     Use dev instead of prod monaco
  28.  
  29. diff --git a/config/webpack.config.dev.js b/config/webpack.config.dev.js
  30. index 92d5629..71197f4 100644
  31. --- a/config/webpack.config.dev.js
  32. +++ b/config/webpack.config.dev.js
  33. @@ -215,7 +215,7 @@ module.exports = {
  34.      // See https://github.com/facebookincubator/create-react-app/issues/186
  35.      new WatchMissingNodeModulesPlugin(paths.appNodeModules),
  36.      new CopyWebpackPlugin([{
  37. -      from: 'node_modules/monaco-editor/min/vs',
  38. +      from: 'node_modules/monaco-editor/dev/vs',
  39.        to: 'vs',
  40.      }]),
  41.      new webpack.optimize.CommonsChunkPlugin(/* chunkName= */"vendor", /* filename= */"vendor.bundle.js")
  42.  
  43. commit a74d809efe53afbd1e49f9608d77619cd71eb786
  44. Author: Matthew Conlen <mc@mathisonian.com>
  45. Date:   Sun Jun 18 15:58:39 2017 -0700
  46.  
  47.     remove unused dep
  48.  
  49. diff --git a/config/webpack.config.dev.js b/config/webpack.config.dev.js
  50. index 7a83230..92d5629 100644
  51. --- a/config/webpack.config.dev.js
  52. +++ b/config/webpack.config.dev.js
  53. @@ -56,7 +56,6 @@ module.exports = {
  54.      vendor: [
  55.        'react',
  56.        'react-dom',
  57. -      'react-grid-layout',
  58.        'react-monaco-editor',
  59.        'react-portal',
  60.        'react-redux',
  61.  
  62. commit bc8a5cbc3304e8b8d804281bd1f3ea7a7175c9ff
  63. Author: Dominik Moritz <domoritz@gmail.com>
  64. Date:   Thu Jun 15 13:52:13 2017 -0700
  65.  
  66.     Fix broken webpack build
  67.  
  68. diff --git a/config/webpack.config.dev.js b/config/webpack.config.dev.js
  69. index 4f99bf3..7a83230 100644
  70. --- a/config/webpack.config.dev.js
  71. +++ b/config/webpack.config.dev.js
  72. @@ -52,7 +52,6 @@ module.exports = {
  73.      //   // We include the app code last so that if there is a runtime error during
  74.      //   // initialization, it doesn't blow up the WebpackDevServer client, and
  75.      //   // changing JS code would still trigger a refresh.
  76. -
  77.      // ],
  78.      vendor: [
  79.        'react',
  80. @@ -122,7 +121,10 @@ module.exports = {
  81.        },
  82.        {
  83.          test: /\.(js|jsx)$/,
  84. -        include: paths.appSrc,
  85. +        include: [
  86. +          paths.appSrc,
  87. +          /\/vega\//  // we need to transpile vega
  88. +        ],
  89.          loader: 'babel',
  90.          query: {
  91.  
  92.  
  93. commit 9642cafa8da31179bcfb0bd27ac3d8dedaeae4be
  94. Author: Dominik Moritz <domoritz@gmail.com>
  95. Date:   Wed Jun 14 15:27:24 2017 -0700
  96.  
  97.     Copy schema from docs instead of re-building vega.
  98.  
  99. diff --git a/config/webpack.config.dev.js b/config/webpack.config.dev.js
  100. index 654a05f..4f99bf3 100644
  101. --- a/config/webpack.config.dev.js
  102. +++ b/config/webpack.config.dev.js
  103. @@ -60,7 +60,6 @@ module.exports = {
  104.        'react-grid-layout',
  105.        'react-monaco-editor',
  106.        'react-portal',
  107. -      'react-resize-detector',
  108.        'react-redux',
  109.        'react-router',
  110.        'react-router-redux',
  111.  
  112. commit 8e3bbc909df236306d03d2d99dc12ef8ae516081
  113. Author: Matthew Conlen <mc@mathisonian.com>
  114. Date:   Sun Jun 11 14:18:24 2017 -0700
  115.  
  116.     remove import
  117.  
  118. diff --git a/config/webpack.config.dev.js b/config/webpack.config.dev.js
  119. index d7132e7..654a05f 100644
  120. --- a/config/webpack.config.dev.js
  121. +++ b/config/webpack.config.dev.js
  122. @@ -9,7 +9,6 @@ var WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeMod
  123.  var getClientEnvironment = require('./env');
  124.  var paths = require('./paths');
  125.  var CopyWebpackPlugin = require('copy-webpack-plugin');
  126. -var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
  127.  
  128.  // Webpack uses `publicPath` to determine where the app is being served from.
  129.  // In development, we always serve from the root. This makes config easier.
  130.  
  131. commit 5089343a19e9d662456847f75e81c71ff4760a8f
  132. Author: Matthew Conlen <mc@mathisonian.com>
  133. Date:   Sun Jun 11 13:31:23 2017 -0700
  134.  
  135.     add a vendor bundle in dev
  136.  
  137. diff --git a/config/webpack.config.dev.js b/config/webpack.config.dev.js
  138. index 6ff5ece..d7132e7 100644
  139. --- a/config/webpack.config.dev.js
  140. +++ b/config/webpack.config.dev.js
  141. @@ -9,6 +9,7 @@ var WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeMod
  142.  var getClientEnvironment = require('./env');
  143.  var paths = require('./paths');
  144.  var CopyWebpackPlugin = require('copy-webpack-plugin');
  145. +var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
  146.  
  147.  // Webpack uses `publicPath` to determine where the app is being served from.
  148.  // In development, we always serve from the root. This makes config easier.
  149. @@ -32,7 +33,7 @@ module.exports = {
  150.    // These are the "entry points" to our application.
  151.    // This means they will be the "root" imports that are included in JS bundle.
  152.    // The first two entry points enable "hot" CSS and auto-refreshes for JS.
  153. -  entry: [
  154. +  entry: {
  155.      // Include an alternative client for WebpackDevServer. A client's job is to
  156.      // connect to WebpackDevServer by a socket and get notified about changes.
  157.      // When you save a file, the client will either apply hot updates (in case
  158. @@ -43,15 +44,33 @@ module.exports = {
  159.      // the line below with these two lines if you prefer the stock client:
  160.      // require.resolve('webpack-dev-server/client') + '?/',
  161.      // require.resolve('webpack/hot/dev-server'),
  162. -    require.resolve('react-dev-utils/webpackHotDevClient'),
  163. -    // We ship a few polyfills by default:
  164. -    require.resolve('./polyfills'),
  165. -    // Finally, this is your app's code:
  166. -    paths.appIndexJs
  167. -    // We include the app code last so that if there is a runtime error during
  168. -    // initialization, it doesn't blow up the WebpackDevServer client, and
  169. -    // changing JS code would still trigger a refresh.
  170. -  ],
  171. +    app: paths.appIndexJs,
  172. +    //  [
  173. +    //   require.resolve('react-dev-utils/webpackHotDevClient'),
  174. +    //   // We ship a few polyfills by default:
  175. +    //   require.resolve('./polyfills'),
  176. +    //   // Finally, this is your app's code:
  177. +    //   // We include the app code last so that if there is a runtime error during
  178. +    //   // initialization, it doesn't blow up the WebpackDevServer client, and
  179. +    //   // changing JS code would still trigger a refresh.
  180. +
  181. +    // ],
  182. +    vendor: [
  183. +      'react',
  184. +      'react-dom',
  185. +      'react-grid-layout',
  186. +      'react-monaco-editor',
  187. +      'react-portal',
  188. +      'react-resize-detector',
  189. +      'react-redux',
  190. +      'react-router',
  191. +      'react-router-redux',
  192. +      'react-split-pane',
  193. +      'redux',
  194. +      'redux-localstorage',
  195. +      'vega'
  196. +    ]
  197. +  },
  198.    output: {
  199.      // Next line is not used in dev but WebpackDevServer crashes without it:
  200.      path: paths.appBuild,
  201. @@ -186,6 +205,7 @@ module.exports = {
  202.      new webpack.DefinePlugin(env),
  203.      // This is necessary to emit hot updates (currently CSS only):
  204.      new webpack.HotModuleReplacementPlugin(),
  205. +
  206.      // Watcher doesn't work well if you mistype casing in a path so we use
  207.      // a plugin that prints an error when you attempt to do this.
  208.      // See https://github.com/facebookincubator/create-react-app/issues/240
  209. @@ -198,7 +218,8 @@ module.exports = {
  210.      new CopyWebpackPlugin([{
  211.        from: 'node_modules/monaco-editor/min/vs',
  212.        to: 'vs',
  213. -    }])
  214. +    }]),
  215. +    new webpack.optimize.CommonsChunkPlugin(/* chunkName= */"vendor", /* filename= */"vendor.bundle.js")
  216.    ],
  217.    // Some libraries import Node modules but don't use them in the browser.
  218.    // Tell Webpack to provide empty mocks for them so importing them works.
  219.  
  220. commit cfcc2d3c87954d08bf10e6ec008e21f17e2da7c9
  221. Author: Matthew Conlen <mc@mathisonian.com>
  222. Date:   Sun Jun 4 13:29:40 2017 -0700
  223.  
  224.     typescript sourcemaps
  225.  
  226. diff --git a/config/webpack.config.dev.js b/config/webpack.config.dev.js
  227. index 5292f29..6ff5ece 100644
  228. --- a/config/webpack.config.dev.js
  229. +++ b/config/webpack.config.dev.js
  230. @@ -28,7 +28,7 @@ module.exports = {
  231.    // We don't use source maps here because they can be confusing:
  232.    // https://github.com/facebookincubator/create-react-app/issues/343#issuecomment-237241875
  233.    // You may want 'cheap-module-source-map' instead if you prefer source maps.
  234. -  devtool: 'eval',
  235. +  devtool: 'cheap-module-source-map',
  236.    // These are the "entry points" to our application.
  237.    // This means they will be the "root" imports that are included in JS bundle.
  238.    // The first two entry points enable "hot" CSS and auto-refreshes for JS.
  239. @@ -91,12 +91,20 @@ module.exports = {
  240.          test: /\.(js|jsx)$/,
  241.          loader: 'eslint',
  242.          include: paths.appSrc,
  243. -      }
  244. +      },
  245.      ],
  246.      loaders: [
  247.        // Process JS with Babel.
  248.        {
  249.          test: /\.(js|jsx)$/,
  250. +        loader: 'source-map-loader'
  251. +      },
  252. +      {
  253. +        test: /\.tsx?$/,
  254. +        loader: 'awesome-typescript-loader'
  255. +      },
  256. +      {
  257. +        test: /\.(js|jsx)$/,
  258.          include: paths.appSrc,
  259.          loader: 'babel',
  260.          query: {
  261.  
  262. commit 8c9a257f94f5b3d69ac8e0da6bddb24acd4ff444
  263. Author: Matthew Conlen <mc@mathisonian.com>
  264. Date:   Wed May 31 10:51:05 2017 -0700
  265.  
  266.     fix loader resolution on linked modules
  267.  
  268. diff --git a/config/webpack.config.dev.js b/config/webpack.config.dev.js
  269. index 0a24782..5292f29 100644
  270. --- a/config/webpack.config.dev.js
  271. +++ b/config/webpack.config.dev.js
  272. @@ -82,7 +82,7 @@ module.exports = {
  273.        'react-native': 'react-native-web'
  274.      }
  275.    },
  276. -
  277. +  resolveLoader: { fallback: path.join(__dirname, '..', "node_modules") },
  278.    module: {
  279.      // First, run the linter.
  280.      // It's important to do this before Babel processes the JS.
  281.  
  282. commit e2666f4cf5b4b05daf800d00cbda4becd90b534e
  283. Author: Matthew Conlen <mc@mathisonian.com>
  284. Date:   Fri Dec 2 17:42:11 2016 -0800
  285.  
  286.     add monaco editor
  287.  
  288. diff --git a/config/webpack.config.dev.js b/config/webpack.config.dev.js
  289. new file mode 100644
  290. index 0000000..0a24782
  291. --- /dev/null
  292. +++ b/config/webpack.config.dev.js
  293. @@ -0,0 +1,202 @@
  294. +var path = require('path');
  295. +var autoprefixer = require('autoprefixer');
  296. +var webpack = require('webpack');
  297. +var findCacheDir = require('find-cache-dir');
  298. +var HtmlWebpackPlugin = require('html-webpack-plugin');
  299. +var CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
  300. +var InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
  301. +var WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
  302. +var getClientEnvironment = require('./env');
  303. +var paths = require('./paths');
  304. +var CopyWebpackPlugin = require('copy-webpack-plugin');
  305. +
  306. +// Webpack uses `publicPath` to determine where the app is being served from.
  307. +// In development, we always serve from the root. This makes config easier.
  308. +var publicPath = '/';
  309. +// `publicUrl` is just like `publicPath`, but we will provide it to our app
  310. +// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
  311. +// Omit trailing shlash as %PUBLIC_PATH%/xyz looks better than %PUBLIC_PATH%xyz.
  312. +var publicUrl = '';
  313. +// Get enrivonment variables to inject into our app.
  314. +var env = getClientEnvironment(publicUrl);
  315. +
  316. +// This is the development configuration.
  317. +// It is focused on developer experience and fast rebuilds.
  318. +// The production configuration is different and lives in a separate file.
  319. +module.exports = {
  320. +  // This makes the bundle appear split into separate modules in the devtools.
  321. +  // We don't use source maps here because they can be confusing:
  322. +  // https://github.com/facebookincubator/create-react-app/issues/343#issuecomment-237241875
  323. +  // You may want 'cheap-module-source-map' instead if you prefer source maps.
  324. +  devtool: 'eval',
  325. +  // These are the "entry points" to our application.
  326. +  // This means they will be the "root" imports that are included in JS bundle.
  327. +  // The first two entry points enable "hot" CSS and auto-refreshes for JS.
  328. +  entry: [
  329. +    // Include an alternative client for WebpackDevServer. A client's job is to
  330. +    // connect to WebpackDevServer by a socket and get notified about changes.
  331. +    // When you save a file, the client will either apply hot updates (in case
  332. +    // of CSS changes), or refresh the page (in case of JS changes). When you
  333. +    // make a syntax error, this client will display a syntax error overlay.
  334. +    // Note: instead of the default WebpackDevServer client, we use a custom one
  335. +    // to bring better experience for Create React App users. You can replace
  336. +    // the line below with these two lines if you prefer the stock client:
  337. +    // require.resolve('webpack-dev-server/client') + '?/',
  338. +    // require.resolve('webpack/hot/dev-server'),
  339. +    require.resolve('react-dev-utils/webpackHotDevClient'),
  340. +    // We ship a few polyfills by default:
  341. +    require.resolve('./polyfills'),
  342. +    // Finally, this is your app's code:
  343. +    paths.appIndexJs
  344. +    // We include the app code last so that if there is a runtime error during
  345. +    // initialization, it doesn't blow up the WebpackDevServer client, and
  346. +    // changing JS code would still trigger a refresh.
  347. +  ],
  348. +  output: {
  349. +    // Next line is not used in dev but WebpackDevServer crashes without it:
  350. +    path: paths.appBuild,
  351. +    // Add /* filename */ comments to generated require()s in the output.
  352. +    pathinfo: true,
  353. +    // This does not produce a real file. It's just the virtual path that is
  354. +    // served by WebpackDevServer in development. This is the JS bundle
  355. +    // containing code from all our entry points, and the Webpack runtime.
  356. +    filename: 'static/js/bundle.js',
  357. +    // This is the URL that app is served from. We use "/" in development.
  358. +    publicPath: publicPath
  359. +  },
  360. +  resolve: {
  361. +    // This allows you to set a fallback for where Webpack should look for modules.
  362. +    // We read `NODE_PATH` environment variable in `paths.js` and pass paths here.
  363. +    // We use `fallback` instead of `root` because we want `node_modules` to "win"
  364. +    // if there any conflicts. This matches Node resolution mechanism.
  365. +    // https://github.com/facebookincubator/create-react-app/issues/253
  366. +    fallback: paths.nodePaths,
  367. +    // These are the reasonable defaults supported by the Node ecosystem.
  368. +    // We also include JSX as a common component filename extension to support
  369. +    // some tools, although we do not recommend using it, see:
  370. +    // https://github.com/facebookincubator/create-react-app/issues/290
  371. +    extensions: ['.js', '.json', '.jsx', ''],
  372. +    alias: {
  373. +      // Support React Native Web
  374. +      // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
  375. +      'react-native': 'react-native-web'
  376. +    }
  377. +  },
  378. +
  379. +  module: {
  380. +    // First, run the linter.
  381. +    // It's important to do this before Babel processes the JS.
  382. +    preLoaders: [
  383. +      {
  384. +        test: /\.(js|jsx)$/,
  385. +        loader: 'eslint',
  386. +        include: paths.appSrc,
  387. +      }
  388. +    ],
  389. +    loaders: [
  390. +      // Process JS with Babel.
  391. +      {
  392. +        test: /\.(js|jsx)$/,
  393. +        include: paths.appSrc,
  394. +        loader: 'babel',
  395. +        query: {
  396. +
  397. +          // This is a feature of `babel-loader` for webpack (not Babel itself).
  398. +          // It enables caching results in ./node_modules/.cache/react-scripts/
  399. +          // directory for faster rebuilds. We use findCacheDir() because of:
  400. +          // https://github.com/facebookincubator/create-react-app/issues/483
  401. +          cacheDirectory: findCacheDir({
  402. +            name: 'react-scripts'
  403. +          })
  404. +        }
  405. +      },
  406. +      // "postcss" loader applies autoprefixer to our CSS.
  407. +      // "css" loader resolves paths in CSS and adds assets as dependencies.
  408. +      // "style" loader turns CSS into JS modules that inject <style> tags.
  409. +      // In production, we use a plugin to extract that CSS to a file, but
  410. +      // in development "style" loader enables hot editing of CSS.
  411. +      {
  412. +        test: /\.css$/,
  413. +        loader: 'style!css!postcss'
  414. +      },
  415. +      // JSON is not enabled by default in Webpack but both Node and Browserify
  416. +      // allow it implicitly so we also enable it.
  417. +      {
  418. +        test: /\.json$/,
  419. +        loader: 'json'
  420. +      },
  421. +      // "file" loader makes sure those assets get served by WebpackDevServer.
  422. +      // When you `import` an asset, you get its (virtual) filename.
  423. +      // In production, they would get copied to the `build` folder.
  424. +      {
  425. +        test: /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2)(\?.*)?$/,
  426. +        loader: 'file',
  427. +        query: {
  428. +          name: 'static/media/[name].[hash:8].[ext]'
  429. +        }
  430. +      },
  431. +      // "url" loader works just like "file" loader but it also embeds
  432. +      // assets smaller than specified size as data URLs to avoid requests.
  433. +      {
  434. +        test: /\.(mp4|webm|wav|mp3|m4a|aac|oga)(\?.*)?$/,
  435. +        loader: 'url',
  436. +        query: {
  437. +          limit: 10000,
  438. +          name: 'static/media/[name].[hash:8].[ext]'
  439. +        }
  440. +      }
  441. +    ]
  442. +  },
  443. +
  444. +  // We use PostCSS for autoprefixing only.
  445. +  postcss: function() {
  446. +    return [
  447. +      autoprefixer({
  448. +        browsers: [
  449. +          '>1%',
  450. +          'last 4 versions',
  451. +          'Firefox ESR',
  452. +          'not ie < 9', // React doesn't support IE8 anyway
  453. +        ]
  454. +      }),
  455. +    ];
  456. +  },
  457. +  plugins: [
  458. +    // Makes the public URL available as %PUBLIC_URL% in index.html, e.g.:
  459. +    // <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
  460. +    // In development, this will be an empty string.
  461. +    new InterpolateHtmlPlugin({
  462. +      PUBLIC_URL: publicUrl
  463. +    }),
  464. +    // Generates an `index.html` file with the <script> injected.
  465. +    new HtmlWebpackPlugin({
  466. +      inject: true,
  467. +      template: paths.appHtml,
  468. +    }),
  469. +    // Makes some environment variables available to the JS code, for example:
  470. +    // if (process.env.NODE_ENV === 'development') { ... }. See `./env.js`.
  471. +    new webpack.DefinePlugin(env),
  472. +    // This is necessary to emit hot updates (currently CSS only):
  473. +    new webpack.HotModuleReplacementPlugin(),
  474. +    // Watcher doesn't work well if you mistype casing in a path so we use
  475. +    // a plugin that prints an error when you attempt to do this.
  476. +    // See https://github.com/facebookincubator/create-react-app/issues/240
  477. +    new CaseSensitivePathsPlugin(),
  478. +    // If you require a missing module and then `npm install` it, you still have
  479. +    // to restart the development server for Webpack to discover it. This plugin
  480. +    // makes the discovery automatic so you don't have to restart.
  481. +    // See https://github.com/facebookincubator/create-react-app/issues/186
  482. +    new WatchMissingNodeModulesPlugin(paths.appNodeModules),
  483. +    new CopyWebpackPlugin([{
  484. +      from: 'node_modules/monaco-editor/min/vs',
  485. +      to: 'vs',
  486. +    }])
  487. +  ],
  488. +  // Some libraries import Node modules but don't use them in the browser.
  489. +  // Tell Webpack to provide empty mocks for them so importing them works.
  490. +  node: {
  491. +    fs: 'empty',
  492. +    net: 'empty',
  493. +    tls: 'empty'
  494. +  }
  495. +};
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement