Skip to content

Commit

Permalink
Merge pull request #3141 from storybooks/use-external-watch-node-modules
Browse files Browse the repository at this point in the history
Use WatchMissingNodeModulesPlugin from react-dev-utils package
  • Loading branch information
Hypnosphi authored Mar 4, 2018
2 parents 2c1ad79 + 276c56f commit 83aac95
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 41 deletions.
3 changes: 2 additions & 1 deletion app/angular/src/server/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import path from 'path';
import webpack from 'webpack';
import Dotenv from 'dotenv-webpack';
import InterpolateHtmlPlugin from 'react-dev-utils/InterpolateHtmlPlugin';
import WatchMissingNodeModulesPlugin from 'react-dev-utils/WatchMissingNodeModulesPlugin';
import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import { WatchMissingNodeModulesPlugin, managerPath } from '@storybook/core/server';
import { managerPath } from '@storybook/core/server';

import { includePaths, excludePaths, nodeModulesPaths, loadEnv, nodePaths } from './utils';
import babelLoaderConfig from './babel';
Expand Down
3 changes: 2 additions & 1 deletion app/polymer/src/server/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import path from 'path';
import webpack from 'webpack';
import Dotenv from 'dotenv-webpack';
import InterpolateHtmlPlugin from 'react-dev-utils/InterpolateHtmlPlugin';
import WatchMissingNodeModulesPlugin from 'react-dev-utils/WatchMissingNodeModulesPlugin';
import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import CopyWebpackPlugin from 'copy-webpack-plugin';
import { WatchMissingNodeModulesPlugin, managerPath } from '@storybook/core/server';
import { managerPath } from '@storybook/core/server';

import { includePaths, excludePaths, nodeModulesPaths, loadEnv, nodePaths } from './utils';
import { getPreviewHeadHtml, getManagerHeadHtml } from '../utils';
Expand Down
1 change: 1 addition & 0 deletions app/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"json5": "^0.5.1",
"markdown-loader": "^2.0.2",
"prop-types": "^15.6.1",
"react-dev-utils": "^5.0.0",
"react-native-compat": "^1.0.0",
"react-native-iphone-x-helper": "^1.0.2",
"shelljs": "^0.8.1",
Expand Down
2 changes: 2 additions & 0 deletions app/react-native/src/server/config/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ export const OccurenceOrderPlugin =
export const includePaths = [path.resolve('./')];

export const excludePaths = [path.resolve('./node_modules')];

export const nodeModulesPaths = path.resolve('./node_modules');
4 changes: 3 additions & 1 deletion app/react-native/src/server/config/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import path from 'path';
import webpack from 'webpack';
import WatchMissingNodeModulesPlugin from 'react-dev-utils/WatchMissingNodeModulesPlugin';
import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import { OccurenceOrderPlugin, includePaths, excludePaths } from './utils';
import { OccurenceOrderPlugin, includePaths, excludePaths, nodeModulesPaths } from './utils';

const getConfig = options => ({
devtool: '#cheap-module-eval-source-map',
Expand All @@ -25,6 +26,7 @@ const getConfig = options => ({
new OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new CaseSensitivePathsPlugin(),
new WatchMissingNodeModulesPlugin(nodeModulesPaths),
],
module: {
rules: [
Expand Down
3 changes: 2 additions & 1 deletion app/react/src/server/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import path from 'path';
import webpack from 'webpack';
import Dotenv from 'dotenv-webpack';
import InterpolateHtmlPlugin from 'react-dev-utils/InterpolateHtmlPlugin';
import WatchMissingNodeModulesPlugin from 'react-dev-utils/WatchMissingNodeModulesPlugin';
import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import { WatchMissingNodeModulesPlugin, managerPath } from '@storybook/core/server';
import { managerPath } from '@storybook/core/server';

import { includePaths, excludePaths, nodeModulesPaths, loadEnv, nodePaths } from './utils';
import babelLoaderConfig from './babel';
Expand Down
3 changes: 2 additions & 1 deletion app/vue/src/server/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import path from 'path';
import webpack from 'webpack';
import Dotenv from 'dotenv-webpack';
import InterpolateHtmlPlugin from 'react-dev-utils/InterpolateHtmlPlugin';
import WatchMissingNodeModulesPlugin from 'react-dev-utils/WatchMissingNodeModulesPlugin';
import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import { WatchMissingNodeModulesPlugin, managerPath } from '@storybook/core/server';
import { managerPath } from '@storybook/core/server';

import { includePaths, excludePaths, nodeModulesPaths, loadEnv, nodePaths } from './utils';
import { getPreviewHeadHtml, getManagerHeadHtml } from '../utils';
Expand Down
2 changes: 0 additions & 2 deletions lib/core/server.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
const assign = require('babel-runtime/core-js/object/assign').default;
const defaultWebpackConfig = require('./dist/server/config/defaults/webpack.config');
const WatchMissingNodeModulesPlugin = require('./dist/server/config/WatchMissingNodeModulesPlugin');
const buildStatic = require('./dist/server/build-static');
const buildDev = require('./dist/server/build-dev');

module.exports = assign({}, defaultWebpackConfig, buildStatic, buildDev, {
WatchMissingNodeModulesPlugin,
managerPath: require.resolve('./dist/client/manager'),
});
34 changes: 0 additions & 34 deletions lib/core/src/server/config/WatchMissingNodeModulesPlugin.js

This file was deleted.

0 comments on commit 83aac95

Please sign in to comment.