-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Core separate manager from preview #4590
Changes from 34 commits
dc81f41
8c26689
ee2c86e
a6ce842
3861fed
d68a106
d09ff40
0120686
750831c
e2f6220
def95df
6fcf4f4
2aad28a
f16b2b6
5a64f33
0477097
baed105
27f096d
3a0f9c9
76a8660
78dd706
d20e8c6
a0a2bdf
c962d90
d53e597
042d3bb
0e01e76
73834fc
825719a
611a846
1767405
4d54763
0f29f20
31e46a3
7cd91d4
e93d9f3
1f29e4c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
module.exports = { | ||
presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-flow'], | ||
plugins: [ | ||
'babel-plugin-emotion', | ||
'babel-plugin-macros', | ||
'@babel/plugin-proposal-class-properties', | ||
'@babel/plugin-proposal-export-default-from', | ||
[ | ||
'@babel/plugin-transform-runtime', | ||
{ | ||
regenerator: true, | ||
}, | ||
], | ||
], | ||
env: { | ||
test: { | ||
plugins: ['babel-plugin-require-context-hook'], | ||
}, | ||
}, | ||
overrides: [ | ||
{ | ||
test: './examples/vue-kitchen-sink', | ||
presets: ['@babel/preset-env', 'babel-preset-vue'], | ||
}, | ||
{ | ||
test: [ | ||
'./lib/core/src/server', | ||
'./lib/node-logger', | ||
'./lib/codemod', | ||
'./addons/storyshots', | ||
'./addons/storysource/src/loader', | ||
'./app/**/src/server/**', | ||
], | ||
presets: [ | ||
[ | ||
'@babel/preset-env', | ||
{ | ||
targets: { | ||
node: '8.11', | ||
}, | ||
}, | ||
], | ||
], | ||
}, | ||
], | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,5 +15,12 @@ export function webpack(config) { | |
}, | ||
], | ||
}, | ||
resolve: { | ||
...config.resolve, | ||
alias: { | ||
...config.resolve.alias, | ||
'riot-compiler': 'riot-compiler/dist/es6.compiler', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure what happened (maybe env changes) but riot-compiler is now resolved to riot-compiler/lib/compiler which is a node version and riot app is failing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oops, I don't know what I can do about it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ndelangen, this issue was not addressed but introduced in this PR... |
||
}, | ||
}, | ||
}; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import findCacheDir from 'find-cache-dir'; | ||
|
||
const extend = babelConfig => ({ | ||
// This is a feature of `babel-loader` for webpack (not Babel itself). | ||
// It enables a cache directory for faster-rebuilds | ||
// `find-cache-dir` will create the cache directory under the node_modules directory. | ||
cacheDirectory: findCacheDir({ name: 'storybook' }), | ||
...babelConfig, | ||
}); | ||
|
||
export { extend as babel, extend as managerBabel }; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
function createProdPresets() { | ||
return [ | ||
[ | ||
require.resolve('babel-preset-minify'), | ||
{ | ||
builtIns: false, | ||
mangle: false, | ||
}, | ||
], | ||
]; | ||
} | ||
|
||
export default ({ configType }) => { | ||
const isProd = configType === 'PRODUCTION'; | ||
const prodPresets = isProd ? createProdPresets() : []; | ||
|
||
return { | ||
presets: [require.resolve('@babel/preset-env'), ...prodPresets], | ||
plugins: [ | ||
require.resolve('babel-plugin-macros'), | ||
require.resolve('@babel/plugin-transform-regenerator'), | ||
require.resolve('@babel/plugin-proposal-class-properties'), | ||
[ | ||
require.resolve('@babel/plugin-transform-runtime'), | ||
{ | ||
helpers: true, | ||
regenerator: true, | ||
}, | ||
], | ||
], | ||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import path from 'path'; | ||
import { logger } from '@storybook/node-logger'; | ||
import serverRequire from '../utils/server-require'; | ||
|
||
export default function loadCustomPresets({ configDir }) { | ||
const presets = serverRequire(path.resolve(configDir, 'presets')); | ||
|
||
if (presets) { | ||
logger.warn( | ||
'"Custom presets" is an experimental and undocumented feature that will be changed or deprecated soon. Use it on your own risk.' | ||
); | ||
|
||
return presets; | ||
} | ||
|
||
return []; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not it be babel.config.js ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got this from here:
https://babeljs.io/docs/en/config-files
Seems to work..