mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
example: fix style
This commit is contained in:
parent
5ef34c6dd8
commit
8a06c7b092
|
@ -16,7 +16,7 @@ export default class MyDocument extends Document {
|
||||||
<title>My page</title>
|
<title>My page</title>
|
||||||
{this.props.stylesheets.map((sheet, i) => (
|
{this.props.stylesheets.map((sheet, i) => (
|
||||||
<style
|
<style
|
||||||
className="_styletron_hydrate_"
|
className='_styletron_hydrate_'
|
||||||
dangerouslySetInnerHTML={{ __html: sheet.css }}
|
dangerouslySetInnerHTML={{ __html: sheet.css }}
|
||||||
media={sheet.media || ''}
|
media={sheet.media || ''}
|
||||||
key={i}
|
key={i}
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
|
|
||||||
// watch and trigger file remove event
|
|
||||||
// see: https://github.com/webpack/webpack/issues/1533
|
|
||||||
|
|
||||||
export default class WatchRemoveEventPlugin {
|
|
||||||
constructor () {
|
|
||||||
this.removedFiles = []
|
|
||||||
}
|
|
||||||
|
|
||||||
apply (compiler) {
|
|
||||||
compiler.removedFiles = []
|
|
||||||
|
|
||||||
if (!compiler.watchFileSystem) return
|
|
||||||
|
|
||||||
const { watchFileSystem } = compiler
|
|
||||||
const { watch } = watchFileSystem
|
|
||||||
|
|
||||||
watchFileSystem.watch = (files, dirs, missing, startTime, options, callback, callbackUndelayed) => {
|
|
||||||
const result = watch.call(watchFileSystem, files, dirs, missing, startTime, options, (...args) => {
|
|
||||||
compiler.removedFiles = this.removedFiles
|
|
||||||
this.removedFiles = []
|
|
||||||
callback(...args)
|
|
||||||
}, callbackUndelayed)
|
|
||||||
|
|
||||||
const watchpack = watchFileSystem.watcher
|
|
||||||
watchpack.on('remove', (file) => {
|
|
||||||
this.removedFiles.push(file)
|
|
||||||
})
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -8,7 +8,6 @@ import FriendlyErrorsWebpackPlugin from 'friendly-errors-webpack-plugin'
|
||||||
import CaseSensitivePathPlugin from 'case-sensitive-paths-webpack-plugin'
|
import CaseSensitivePathPlugin from 'case-sensitive-paths-webpack-plugin'
|
||||||
import UnlinkFilePlugin from './plugins/unlink-file-plugin'
|
import UnlinkFilePlugin from './plugins/unlink-file-plugin'
|
||||||
import WatchPagesPlugin from './plugins/watch-pages-plugin'
|
import WatchPagesPlugin from './plugins/watch-pages-plugin'
|
||||||
import WatchRemoveEventPlugin from './plugins/watch-remove-event-plugin'
|
|
||||||
import JsonPagesPlugin from './plugins/json-pages-plugin'
|
import JsonPagesPlugin from './plugins/json-pages-plugin'
|
||||||
import getConfig from '../config'
|
import getConfig from '../config'
|
||||||
|
|
||||||
|
@ -87,7 +86,6 @@ export default async function createCompiler (dir, { dev = false, quiet = false
|
||||||
new webpack.HotModuleReplacementPlugin(),
|
new webpack.HotModuleReplacementPlugin(),
|
||||||
new webpack.NoEmitOnErrorsPlugin(),
|
new webpack.NoEmitOnErrorsPlugin(),
|
||||||
new UnlinkFilePlugin(),
|
new UnlinkFilePlugin(),
|
||||||
new WatchRemoveEventPlugin(),
|
|
||||||
new WatchPagesPlugin(dir)
|
new WatchPagesPlugin(dir)
|
||||||
)
|
)
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
|
|
Loading…
Reference in a new issue