Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

refactor: use webpack context when notifying CLI for changed files #455

Merged
merged 12 commits into from
Mar 10, 2018

Conversation

sis0k0
Copy link
Contributor

@sis0k0 sis0k0 commented Mar 6, 2018

@sis0k0 sis0k0 requested a review from Mitko-Kerezov March 6, 2018 13:39
lib/utils.js Outdated

function buildEnvData(platform, env) {
return {
...env,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This syntax was introduced in NodeJS 8 and later, whereas we currently support and recommend NodeJS 6

context => `!${context}`
);

return [...originalPatterns, ...ignorePatterns];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old logic spliced the unneeded watch pattern, whereas the new logic adds an exclusion and retains the originalPatterns.
Whenever we have ["app", "app/App_Resources", "!app"] in watch patterns - does this work as expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed in person.

lib/utils.js Outdated
const projectDir = getProjectDir();
const config = getWebpackConfig(projectDir, env);
const context = config.context || projectDir;
const absolutePathToContext = path.resolve(context);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some concerns about using just path.resolve here because if memory serves correctly the context is listed as "./app" in the config file and the user may launch cli with --path from another current working directory - will that work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Launching with --path and --bundle doesn't work in the master branch too. We're using path.resolve for getting the absolute path of the context (here), because webpack expects absolute paths.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed in person. Now using paths relative to __dirname in the webpack configs and path.relative with projectDir when running the build.

} catch (e) {
throw new Error(
`Couldn't load webpack config from ${configAbsolutePath}. ` +
`Original error:\n${e}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a merge-stopper but I'd rather we use require('os').EOL instead of a hardcoded string here

@sis0k0 sis0k0 force-pushed the sis0k0/use-compilation-context-compiler branch from 1b739f2 to 875fd3e Compare March 6, 2018 16:58
@sis0k0
Copy link
Contributor Author

sis0k0 commented Mar 6, 2018

@Mitko-Kerezov, addressed the review comments with the last commits.

Copy link
Contributor

@Mitko-Kerezov Mitko-Kerezov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks okay to me

@sis0k0
Copy link
Contributor Author

sis0k0 commented Mar 7, 2018

test

@sis0k0 sis0k0 merged commit 9342eef into master Mar 10, 2018
@sis0k0 sis0k0 deleted the sis0k0/use-compilation-context-compiler branch March 10, 2018 19:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants