Skip to content
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 babel extends issue #172 by replacing with absolute paths #185

Merged
merged 1 commit into from
May 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions dist/manager.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/manager.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 15 additions & 3 deletions dist/server/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,22 @@ var _extends3 = _interopRequireDefault(_extends2);
exports.default = function (configType, baseConfig, configDir) {
var config = baseConfig;

// search for a .babelrc in the config directory, then the module root directory
// if found, use that to extend webpack configurations
var babelConfig = loadBabelConfig(_path2.default.resolve(configDir, '.babelrc')) || loadBabelConfig('.babelrc');
// Search for a .babelrc in the config directory, then the module root
// directory. If found, use that to extend webpack configurations.
var babelConfig = loadBabelConfig(_path2.default.resolve(configDir, '.babelrc'));
var inConfigDir = true;

if (!babelConfig) {
babelConfig = loadBabelConfig('.babelrc');
inConfigDir = false;
}

if (babelConfig) {
// If the custom config uses babel's `extends` clause, then replace it with
// an absolute path. `extends` will not work unless we do this.
if (babelConfig.extends) {
babelConfig.extends = inConfigDir ? _path2.default.resolve(configDir, babelConfig.extends) : _path2.default.resolve(babelConfig.extends);
}
config.module.loaders[0].query = babelConfig;
}

Expand Down
22 changes: 17 additions & 5 deletions src/server/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,24 @@ function loadBabelConfig(babelConfigPath) {
export default function (configType, baseConfig, configDir) {
const config = baseConfig;

// search for a .babelrc in the config directory, then the module root directory
// if found, use that to extend webpack configurations
const babelConfig =
loadBabelConfig(path.resolve(configDir, '.babelrc')) ||
loadBabelConfig('.babelrc');
// Search for a .babelrc in the config directory, then the module root
// directory. If found, use that to extend webpack configurations.
let babelConfig = loadBabelConfig(path.resolve(configDir, '.babelrc'));
let inConfigDir = true;

if (!babelConfig) {
babelConfig = loadBabelConfig('.babelrc');
inConfigDir = false;
}

if (babelConfig) {
// If the custom config uses babel's `extends` clause, then replace it with
// an absolute path. `extends` will not work unless we do this.
if (babelConfig.extends) {
babelConfig.extends = inConfigDir ?
path.resolve(configDir, babelConfig.extends) :
path.resolve(babelConfig.extends);
}
config.module.loaders[0].query = babelConfig;
}

Expand Down