diff --git a/dist/client/preview/index.js b/dist/client/preview/index.js index 1fe605c5bde7..9a2ca74f9cab 100644 --- a/dist/client/preview/index.js +++ b/dist/client/preview/index.js @@ -55,7 +55,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de var _global = global, navigator = _global.navigator; /* global window */ -var isBrowser = navigator && navigator.userAgent !== 'storyshots'; +var isBrowser = navigator && navigator.userAgent !== 'storyshots' && !navigator.userAgent.includes('Node.js'); var storyStore = new _story_store2.default(); var reduxStore = (0, _redux.createStore)(_reducer2.default); diff --git a/dist/server/config/defaults/webpack.config.js b/dist/server/config/defaults/webpack.config.js index 8afac3101dc2..7f623eaa5dbd 100644 --- a/dist/server/config/defaults/webpack.config.js +++ b/dist/server/config/defaults/webpack.config.js @@ -19,29 +19,24 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de // Add a default custom config which is similar to what React Create App does. module.exports = function (storybookBaseConfig) { var newConfig = (0, _extends3.default)({}, storybookBaseConfig); - newConfig.module.loaders = [].concat((0, _toConsumableArray3.default)(storybookBaseConfig.module.loaders), [{ - test: /\.css?$/, - include: _utils.includePaths, - loaders: [require.resolve('style-loader'), require.resolve('css-loader') + '?importLoaders=1', require.resolve('postcss-loader')] - }, { - test: /\.json$/, - include: _utils.includePaths, - loader: require.resolve('json-loader') - }, { - test: /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2)(\?.*)?$/, + newConfig.module.loaders = [].concat((0, _toConsumableArray3.default)(storybookBaseConfig.module.loaders), [ + // This loads all other assets using the file-loader except for + // the excluded extentions. Because they have their own loaders. + { include: _utils.includePaths, + exclude: [/\.html$/, /\.(js|jsx)$/, /\.css$/, /\.json$/], loader: require.resolve('file-loader'), query: { name: 'static/media/[name].[hash:8].[ext]' } }, { - test: /\.(mp4|webm|wav|mp3|m4a|aac|oga)(\?.*)?$/, + test: /\.css?$/, include: _utils.includePaths, - loader: require.resolve('url-loader'), - query: { - limit: 10000, - name: 'static/media/[name].[hash:8].[ext]' - } + loaders: [require.resolve('style-loader'), require.resolve('css-loader') + '?importLoaders=1', require.resolve('postcss-loader')] + }, { + test: /\.json$/, + include: _utils.includePaths, + loader: require.resolve('json-loader') }]); newConfig.postcss = function () { diff --git a/src/server/config/defaults/webpack.config.js b/src/server/config/defaults/webpack.config.js index 8fcad8c5394e..f5b5a449fe84 100644 --- a/src/server/config/defaults/webpack.config.js +++ b/src/server/config/defaults/webpack.config.js @@ -6,6 +6,21 @@ module.exports = (storybookBaseConfig) => { const newConfig = { ...storybookBaseConfig }; newConfig.module.loaders = [ ...storybookBaseConfig.module.loaders, + // This loads all other assets using the file-loader except for + // the excluded extentions. Because they have their own loaders. + { + include: includePaths, + exclude: [ + /\.html$/, + /\.(js|jsx)$/, + /\.css$/, + /\.json$/, + ], + loader: require.resolve('file-loader'), + query: { + name: 'static/media/[name].[hash:8].[ext]', + }, + }, { test: /\.css?$/, include: includePaths, @@ -20,23 +35,6 @@ module.exports = (storybookBaseConfig) => { include: includePaths, loader: require.resolve('json-loader'), }, - { - test: /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2)(\?.*)?$/, - include: includePaths, - loader: require.resolve('file-loader'), - query: { - name: 'static/media/[name].[hash:8].[ext]', - }, - }, - { - test: /\.(mp4|webm|wav|mp3|m4a|aac|oga)(\?.*)?$/, - include: includePaths, - loader: require.resolve('url-loader'), - query: { - limit: 10000, - name: 'static/media/[name].[hash:8].[ext]', - }, - }, ]; newConfig.postcss = () => {