Skip to content

Commit 8c26472

Browse files
committedAug 25, 2020
fix: handle HMR for tailwind config
Fixes #157
1 parent d6cb9ad commit 8c26472

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed
 

‎lib/module.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
const { join, resolve, relative } = require('path')
22
const { pathExists } = require('fs-extra')
33
const defu = require('defu')
4+
const clearModule = require('clear-module')
5+
46
const logger = require('./logger')
57
const defaultTailwindConfig = require('./files/tailwind.config.js')
68

@@ -27,6 +29,7 @@ module.exports = async function (moduleOptions) {
2729
// Get and extend the Tailwind config
2830
let tailwindConfig = {}
2931
if (await pathExists(configPath)) {
32+
clearModule(configPath)
3033
tailwindConfig = require(configPath)
3134
logger.info(`Merging Tailwind config from ~/${relative(this.options.rootDir, configPath)}`)
3235
}

‎package.json

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"lib"
2525
],
2626
"dependencies": {
27+
"clear-module": "^4.1.1",
2728
"consola": "^2.15.0",
2829
"defu": "^3.1.0",
2930
"fs-extra": "^9.0.1",

‎yarn.lock

+16-1
Original file line numberDiff line numberDiff line change
@@ -2976,7 +2976,7 @@ callsites@^2.0.0:
29762976
resolved "https://registry.yarnpkg.com/callsites/-/callsites-2.0.0.tgz#06eb84f00eea413da86affefacbffb36093b3c50"
29772977
integrity sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=
29782978

2979-
callsites@^3.0.0:
2979+
callsites@^3.0.0, callsites@^3.1.0:
29802980
version "3.1.0"
29812981
resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73"
29822982
integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==
@@ -3234,6 +3234,14 @@ clean-stack@^2.0.0:
32343234
resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b"
32353235
integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==
32363236

3237+
clear-module@^4.1.1:
3238+
version "4.1.1"
3239+
resolved "https://registry.yarnpkg.com/clear-module/-/clear-module-4.1.1.tgz#bf8ba3b62eb70ee1e0adec90589741425cf32db8"
3240+
integrity sha512-ng0E7LeODcT3QkazOckzZqbca+JByQy/Q2Z6qO24YsTp+pLxCfohGz2gJYJqZS0CWTX3LEUiHOqe5KlYeUbEMw==
3241+
dependencies:
3242+
parent-module "^2.0.0"
3243+
resolve-from "^5.0.0"
3244+
32373245
cli-boxes@^2.2.0:
32383246
version "2.2.0"
32393247
resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-2.2.0.tgz#538ecae8f9c6ca508e3c3c95b453fe93cb4c168d"
@@ -8212,6 +8220,13 @@ parent-module@^1.0.0:
82128220
dependencies:
82138221
callsites "^3.0.0"
82148222

8223+
parent-module@^2.0.0:
8224+
version "2.0.0"
8225+
resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-2.0.0.tgz#fa71f88ff1a50c27e15d8ff74e0e3a9523bf8708"
8226+
integrity sha512-uo0Z9JJeWzv8BG+tRcapBKNJ0dro9cLyczGzulS6EfeyAdeC9sbojtW6XwvYxJkEne9En+J2XEl4zyglVeIwFg==
8227+
dependencies:
8228+
callsites "^3.1.0"
8229+
82158230
parse-asn1@^5.0.0, parse-asn1@^5.1.5:
82168231
version "5.1.5"
82178232
resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.5.tgz#003271343da58dc94cace494faef3d2147ecea0e"

0 commit comments

Comments
 (0)
Please sign in to comment.