Switch to separate config import
Import default config from separate path (require('tailwindcss/defaultConfig')) to allow importing the default config without importing all of Tailwind, which causes errors with Webpack due to a dynamic require.
This commit is contained in:
parent
5e6bfb2f9e
commit
1faabc82b1
9 changed files with 781 additions and 782 deletions
|
|
@ -52,7 +52,7 @@ program
|
|||
process.exit(1)
|
||||
}
|
||||
|
||||
const output = fs.readFileSync(path.resolve(__dirname, '../defaultConfig.js'), 'utf8')
|
||||
const output = fs.readFileSync(path.resolve(__dirname, '../defaultConfig.stub.js'), 'utf8')
|
||||
fs.outputFileSync(destination, output.replace('// var defaultConfig', 'var defaultConfig'))
|
||||
console.log(`Generated Tailwind config: ${destination}`)
|
||||
process.exit()
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ const plugin = postcss.plugin('tailwind', config => {
|
|||
|
||||
const lazyConfig = () => {
|
||||
if (_.isUndefined(config)) {
|
||||
return require('../defaultConfig')
|
||||
return require('../defaultConfig')()
|
||||
}
|
||||
|
||||
delete require.cache[require.resolve(path.resolve(config))]
|
||||
|
|
@ -46,8 +46,4 @@ const plugin = postcss.plugin('tailwind', config => {
|
|||
)
|
||||
})
|
||||
|
||||
plugin.defaultConfig = function() {
|
||||
return _.cloneDeep(require('../defaultConfig'))
|
||||
}
|
||||
|
||||
module.exports = plugin
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue