-
-
Notifications
You must be signed in to change notification settings - Fork 376
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
Fix the exception thrown when writeToDisk
is enabled in multi-compiler mode
#301
Merged
shellscape
merged 4 commits into
webpack:master
from
arianrhodsandlot:fix-multi-compiler
Apr 19, 2018
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -377,4 +377,49 @@ describe('Server', () => { | |
}); | ||
}); | ||
}); | ||
|
||
function writeToDiskWithMultiCompiler(value, done) { | ||
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. maintainer's preference here: please do shorten this function name. something under 15 characters preferably, e.g. |
||
app = express(); | ||
const compiler = webpack(webpackMultiConfig); | ||
instance = middleware(compiler, { | ||
stats: 'errors-only', | ||
logLevel, | ||
writeToDisk: value | ||
}); | ||
app.use(instance); | ||
app.use((req, res) => { | ||
res.sendStatus(200); | ||
}); | ||
listen = listenShorthand(done); | ||
} | ||
|
||
describe('write to disk with MultiCompiler', () => { | ||
before((done) => { | ||
writeToDiskWithMultiCompiler(true, done); | ||
}); | ||
after(close); | ||
|
||
it('should find the bundle files on disk', (done) => { | ||
request(app).get('/foo/bar') | ||
.expect(200, () => { | ||
const bundleFiles = [ | ||
'../fixtures/server-test/js1/foo.js', | ||
'../fixtures/server-test/js1/index.html', | ||
'../fixtures/server-test/js1/svg.svg', | ||
'../fixtures/server-test/js2/bar.js' | ||
]; | ||
|
||
for (const bundleFile of bundleFiles) { | ||
const bundlePath = path.join(__dirname, bundleFile); | ||
assert(fs.existsSync(bundlePath)); | ||
fs.unlinkSync(bundlePath); | ||
} | ||
|
||
fs.rmdirSync(path.join(__dirname, '../fixtures/server-test/js1/')); | ||
fs.rmdirSync(path.join(__dirname, '../fixtures/server-test/js2/')); | ||
|
||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
curious: previous tests pass on this with the
path.resolve
. is there a reason for this change?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.
As documented,
output.path
should be an absolute path. And withoutpath.resolve
, it will attempt to write files into the root directory/
. This configuration didn't cause an error in the past because files are all in memory when no test cases withwriteToDisk: true
are using it.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.
excellent, thank you