-
-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #169 from webpack-contrib/feat/new-resolver
Feat/new resolver
- Loading branch information
Showing
17 changed files
with
178 additions
and
82 deletions.
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* The stringifyLoader turns any content into a valid JavaScript string. This allows us to load any content | ||
* with loaderContext.loadModule() without webpack complaining about non-JS modules. | ||
* | ||
* @param {string} content | ||
* @return {string} | ||
*/ | ||
function stringifyLoader(content) { | ||
return JSON.stringify(content); | ||
} | ||
|
||
module.exports = stringifyLoader; |
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// You can't use include paths and webpack's resolver simulatenously. | ||
@import "some/module.less"; | ||
@import "~some/module.less"; |
Empty file.
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
@import "folder/some.file"; |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// some/module.less is intended to be loaded from node_modules if the folder is configured as include path. | ||
// webpack would expect this import to be prepended with a ~ character. | ||
@import "some/module.less"; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
const lessLoader = require.resolve('../../src'); | ||
const helperLoader = require.resolve('./helperLoader.js'); | ||
const someFileLoader = require.resolve('./someFileLoader.js'); | ||
|
||
function basic(lessLoaderOptions, lessLoaderContext = {}, inspectCallback = () => {}) { | ||
return [{ | ||
test: /\.less$/, | ||
loaders: [{ | ||
loader: helperLoader, | ||
options: lessLoaderContext, | ||
}, { | ||
loader: 'inspect-loader', | ||
options: { | ||
callback: inspectCallback, | ||
}, | ||
}, | ||
{ | ||
loader: lessLoader, | ||
options: lessLoaderOptions, | ||
}], | ||
}]; | ||
} | ||
|
||
function nonLessImport(inspectCallback) { | ||
return [{ | ||
test: /\.less$/, | ||
loaders: [{ | ||
loader: helperLoader, | ||
}, { | ||
loader: 'inspect-loader', | ||
options: { | ||
callback: inspectCallback, | ||
}, | ||
}, { | ||
loader: lessLoader, | ||
}], | ||
}, { | ||
test: /some\.file$/, | ||
loaders: [{ | ||
loader: someFileLoader, | ||
}], | ||
}]; | ||
} | ||
|
||
exports.basic = basic; | ||
exports.nonLessImport = nonLessImport; |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
function someFileLoader() { | ||
return '.some-file { background: hotpink; }'; | ||
} | ||
|
||
module.exports = someFileLoader; |
Oops, something went wrong.