Skip to content

Tune default options #133

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

Merged
merged 2 commits into from
Jun 11, 2017
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
11 changes: 5 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
language: node_js
node_js:
- "6"
- "5"
- "7"
- "4"

env:
matrix:
- WEBPACK_VERSION=1.13.1 EXTRACT_TEXT_VERSION=1
- WEBPACK_VERSION=2.2.1 EXTRACT_TEXT_VERSION=2.0.0
- WEBPACK_VERSION=1 EXTRACT_TEXT_VERSION=1
- WEBPACK_VERSION=2 EXTRACT_TEXT_VERSION=2
matrix:
fast_finish: true
allow_failures:
- node_js: "4"
env: WEBPACK_VERSION=2.2.1 EXTRACT_TEXT_VERSION=2.0.0
env: WEBPACK_VERSION=2 EXTRACT_TEXT_VERSION=2
before_script:
- npm rm webpack extract-text-webpack-plugin
- npm install webpack@$WEBPACK_VERSION extract-text-webpack-plugin@$EXTRACT_TEXT_VERSION
cache:
directories:
- node_modules
- node_modules
15 changes: 10 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ function serializeHashContent(module) {
// };

function HardSourceWebpackPlugin(options) {
this.options = options;
this.options = options || {};
}

HardSourceWebpackPlugin.prototype.getPath = function(dirName, suffix) {
Expand Down Expand Up @@ -280,7 +280,11 @@ HardSourceWebpackPlugin.prototype.apply = function(compiler) {
logger.lock();

if (!options.cacheDirectory) {
options.cacheDirectory = 'node_modules/.cache/hard-source/[confighash]';
options.cacheDirectory = path.resolve(
process.cwd(),
compiler.options.context,
'node_modules/.cache/hard-source/[confighash]'
);
}

this.compilerOutputOptions = compiler.options.output;
Expand Down Expand Up @@ -395,8 +399,8 @@ HardSourceWebpackPlugin.prototype.apply = function(compiler) {
!compiler.options.recordsInputPath &&
!compiler.options.recordsPath
) {
compiler.options.recordsInputPath =
this.getPath('node_modules/.cache/hard-source/[confighash]/records.json');
options.recordsInputPath = path.join(options.cacheDirectory, 'records.json');
compiler.options.recordsInputPath = this.getPath(options.recordsInputPath);
}
if (options.recordsOutputPath || options.recordsPath) {
if (compiler.options.recordsOutputPath || compiler.options.recordsPath) {
Expand All @@ -421,8 +425,9 @@ HardSourceWebpackPlugin.prototype.apply = function(compiler) {
!compiler.options.recordsOutputPath &&
!compiler.options.recordsPath
) {
options.recordsOutputPath = path.join(options.cacheDirectory, 'records.json');
compiler.options.recordsOutputPath =
this.getPath('node_modules/.cache/hard-source/[confighash]/records.json');
this.getPath(options.recordsOutputPath);
}

var cacheDirPath = this.getCachePath();
Expand Down