Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADD a no-dll option to CLI to disable DllReferencePlugin, fix polyfills missing in manager #5238

Merged
merged 2 commits into from Jan 14, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/core/src/server/cli/dev.js
Expand Up @@ -34,6 +34,7 @@ async function getCLI(packageJson) {
.option('--smoke-test', 'Exit after successful start')
.option('--ci', "CI mode (skip interactive prompts, don't open browser")
.option('--quiet', 'Suppress verbose build output')
.option('--no-dll', 'Do not use dll reference')
.parse(process.argv);

logger.info(chalk.bold(`${packageJson.name} v${packageJson.version}`) + chalk.reset('\n'));
Expand Down
1 change: 1 addition & 0 deletions lib/core/src/server/cli/prod.js
Expand Up @@ -13,6 +13,7 @@ function getCLI(packageJson) {
.option('-c, --config-dir [dir-name]', 'Directory where to load Storybook configurations from')
.option('-w, --watch', 'Enable watch mode')
.option('--quiet', 'Suppress verbose build output')
.option('--no-dll', 'Do not use dll reference')
.parse(process.argv);

logger.info(chalk.bold(`${packageJson.name} v${packageJson.version}\n`));
Expand Down
1 change: 1 addition & 0 deletions lib/core/src/server/dev-server.js
Expand Up @@ -37,6 +37,7 @@ export default async function(options) {
configDir,
cache,
corePresets: [require.resolve('./manager/manager-preset.js')],
...options,
}).then(
config =>
new Promise((resolve, reject) => {
Expand Down
2 changes: 1 addition & 1 deletion lib/core/src/server/manager/manager-preset.js
Expand Up @@ -7,7 +7,7 @@ export async function managerWebpack(_, options) {

export async function managerEntries(_, options) {
const { presets } = options;
const entries = [];
const entries = [require.resolve('../common/polyfills')];

const installedAddons = await presets.apply('addons', [], options);

Expand Down
20 changes: 11 additions & 9 deletions lib/core/src/server/manager/manager-webpack.config.js
Expand Up @@ -12,11 +12,11 @@ import { getManagerHeadHtml } from '../utils/template';
import { loadEnv } from '../config/utils';
import babelLoader from '../common/babel-loader';

// const coreDirName = path.dirname(require.resolve('@storybook/core/package.json'));
// const context = path.join(coreDirName, '../../node_modules');
const coreDirName = path.dirname(require.resolve('@storybook/core/package.json'));
const context = path.join(coreDirName, '../../node_modules');
const cacheDir = findCacheDir({ name: 'storybook' });

export default ({ configDir, configType, entries, outputDir, cache, babelOptions }) => {
export default ({ configDir, configType, entries, dll, outputDir, cache, babelOptions }) => {
const { raw, stringified } = loadEnv();
const isProd = configType === 'PRODUCTION';

Expand All @@ -33,10 +33,12 @@ export default ({ configDir, configType, entries, outputDir, cache, babelOptions
},
cache,
plugins: [
// new webpack.DllReferencePlugin({
// context,
// manifest: path.join(__dirname, '../../../dll/storybook_ui-manifest.json'),
// }),
dll
? new webpack.DllReferencePlugin({
context,
manifest: path.join(__dirname, '../../../dll/storybook_ui-manifest.json'),
})
: null,
new HtmlWebpackPlugin({
filename: `index.html`,
chunksSortMode: 'none',
Expand All @@ -47,15 +49,15 @@ export default ({ configDir, configType, entries, outputDir, cache, babelOptions
files,
options,
version,
dlls: ['/sb_dll/storybook_ui_dll.js'],
dlls: dll ? ['/sb_dll/storybook_ui_dll.js'] : [],
headHtmlSnippet: getManagerHeadHtml(configDir, process.env),
}),
template: require.resolve(`../templates/index.ejs`),
}),
new webpack.DefinePlugin({ 'process.env': stringified }),
new CaseSensitivePathsPlugin(),
new Dotenv({ silent: true }),
],
].filter(Boolean),
module: {
rules: [babelLoader(babelOptions)],
},
Expand Down