presets icon indicating copy to clipboard operation
presets copied to clipboard

【question】Is there a way to set global Decorator and Parameters in preset ?

Open QingLeiLi opened this issue 5 years ago • 2 comments

I am writing a preset to make my config reuseable, I find There is a lot config in the .storybook/config.js file, I want move it to the preset, but I had not find a way to do it on the doc, is it possible ? Thanks in advance.

QingLeiLi avatar Nov 23 '19 05:11 QingLeiLi

I find config hook in the source code, This is what I do.

// my-preset.js
module.exports = {
    config: function(config){
        return [...config, require.resolve('./config.js')];
    }
}

Works fine, but you can not use require.context API in the file, maybe It is out of the project dir, webpack does not process it.

QingLeiLi avatar Nov 23 '19 13:11 QingLeiLi

Sorry, It work not fine, I find the addon and manage use different channel, case data not update. Could someone tell how split the config out ?

QingLeiLi avatar Nov 24 '19 10:11 QingLeiLi