Skip to content

Commit 86d24d7

Browse files
committed
Use path.resolve to return absolute paths (required by webpack)
1 parent e55d81d commit 86d24d7

File tree

5 files changed

+17
-24
lines changed

5 files changed

+17
-24
lines changed

admin/webpack.admin.config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ var path = require('path');
33
var common = require('../webpack.common.config.js');
44
var BundleTracker = require('webpack-bundle-tracker');
55

6-
var websiteRoot = path.join(__dirname, '..', 'website', 'static');
6+
var websiteRoot = path.resolve(__dirname, '..', 'website', 'static');
77

8-
var adminRoot = path.join(__dirname, 'static');
8+
var adminRoot = path.resolve(__dirname, 'static');
99

1010
var staticAdminPath = function(dir) {
11-
return path.join(adminRoot, dir);
11+
return path.resolve(adminRoot, dir);
1212
};
1313

1414
// Adding bundle tracker to plugins
@@ -22,7 +22,7 @@ var plugins = common.plugins.concat([
2222
]);
2323

2424
common.output = {
25-
path: path.join(__dirname, 'static', 'public', 'js'),
25+
path: path.resolve(__dirname, 'static', 'public', 'js'),
2626
// publicPath: '/static/', // used to generate urls to e.g. images
2727
filename: '[name].js',
2828
sourcePrefix: ''

admin/webpack.prod.config.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,9 @@ module.exports = assign(admin, {
3131
minimize: true
3232
})
3333
]),
34-
output: {
35-
path: './static/public/js/',
34+
output: Object.assign({}, admin.output, {
3635
// publicPath: '/static/', // used to generate urls to e.g. images
37-
3836
// Append hash to filenames for cachebusting
3937
filename: '[name].[chunkhash].js',
40-
sourcePrefix: ''
41-
}
38+
}),
4239
});

karma.common.conf.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/**
2-
*
3-
*/
4-
51
var webpack = require('webpack');
62
var webpackCommon = require('./webpack.common.config.js');
73

webpack.common.config.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ var fs = require('fs');
55
var SaveAssetsJson = require('assets-webpack-plugin');
66

77
var addons = require('./addons.json');
8-
var root = path.join(__dirname, 'website', 'static');
8+
var root = path.resolve(__dirname, 'website', 'static');
99
/** Return the absolute path given a path relative to ./website/static */
1010
var staticPath = function(dir) {
11-
return path.join(root, dir);
11+
return path.resolve(root, dir);
1212
};
1313
var nodePath = function(dir) {
14-
return path.join(__dirname, 'node_modules', dir);
14+
return path.resolve(__dirname, 'node_modules', dir);
1515
};
1616
var addonsPath = function(dir) {
17-
return path.join(__dirname, 'addons', dir);
17+
return path.resolve(__dirname, 'addons', dir);
1818
};
1919

2020
/**
@@ -103,20 +103,20 @@ var addonModules = ['files.js', 'node-cfg.js', 'user-cfg.js', 'file-detail.js',
103103
addons.addons.forEach(function(addonName) {
104104
var baseDir = addonName + '/';
105105
addonModules.forEach(function(module) {
106-
var modulePath = path.join(__dirname, 'addons',
106+
var modulePath = path.resolve(__dirname, 'addons',
107107
addonName, 'static', module);
108108
if (fs.existsSync(modulePath)) {
109109
var entryPoint = baseDir + module.split('.')[0];
110110
entry[entryPoint] = modulePath;
111111
}
112112
});
113-
var logTextPath = path.join(__dirname, 'addons',
113+
var logTextPath = path.resolve(__dirname, 'addons',
114114
addonName, 'static', addonName + 'LogActionList.json');
115115
if(fs.existsSync(logTextPath)){
116116
addonLog = require(logTextPath);
117117
for (var attrname in addonLog) { mainLogs[attrname] = addonLog[attrname]; }
118118
}
119-
var anonymousLogTextPath = path.join(__dirname, 'addons',
119+
var anonymousLogTextPath = path.resolve(__dirname, 'addons',
120120
addonName, 'static', addonName + 'AnonymousLogActionList.json');
121121
if(fs.existsSync(anonymousLogTextPath)) {
122122
anonymousAddonLog = require(anonymousLogTextPath);
@@ -161,7 +161,7 @@ var resolve = {
161161
'highlight-css': nodePath('highlight.js/styles/default.css'),
162162
'pikaday-css': nodePath('pikaday/css/pikaday.css'),
163163
// Also alias some internal libraries for easy access
164-
'addons': path.join(__dirname, 'addons'),
164+
'addons': path.resolve(__dirname, 'addons'),
165165
'tests': staticPath('js/tests'),
166166
// GASP Items not defined as main in its package.json
167167
'TweenLite' : nodePath('gsap/src/minified/TweenLite.min.js'),
@@ -190,12 +190,12 @@ var plugins = [
190190
// Slight hack to make sure that CommonJS is always used
191191
new webpack.DefinePlugin({
192192
'define.amd': false,
193-
'__ENABLE_DEV_MODE_CONTROLS': fs.existsSync(staticPath(path.join('built', 'git_logs.json')))
193+
'__ENABLE_DEV_MODE_CONTROLS': fs.existsSync(staticPath(path.resolve('built', 'git_logs.json')))
194194
}),
195195
];
196196

197197
var output = {
198-
path: path.join(__dirname, 'website', 'static', 'public', 'js'),
198+
path: path.resolve(__dirname, 'website', 'static', 'public', 'js'),
199199
// publicPath: '/static/', // used to generate urls to e.g. images
200200
filename: '[name].js',
201201
sourcePrefix: ''

webpack.prod.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = assign(common, {
3333
})
3434
]),
3535
output: {
36-
path: path.join(__dirname, 'website', 'static', 'public', 'js'),
36+
path: path.resolve(__dirname, 'website', 'static', 'public', 'js'),
3737
// publicPath: '/static/', // used to generate urls to e.g. images
3838

3939
// Append hash to filenames for cachebusting

0 commit comments

Comments
 (0)