Skip to content
This repository has been archived by the owner on Mar 14, 2022. It is now read-only.

Commit

Permalink
Enable loaders to be resolved from a consuming applications node_modu…
Browse files Browse the repository at this point in the history
…les folder (#511)
  • Loading branch information
JakeChampion authored Feb 14, 2018
1 parent 828e3f7 commit e0b909d
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 26 deletions.
8 changes: 6 additions & 2 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const path = require('path');
const BowerResolvePlugin = require('bower-resolve-webpack-plugin');
const appRoot = require('app-root-path');

module.exports = {
// Fail out on the first error instead of tolerating it.
Expand Down Expand Up @@ -31,10 +32,13 @@ module.exports = {
// These extensions are tried when resolving a file
extensions: ['.js', '.json']
},
// Resolve loaders (webpack plugins) from the
// directory of `OBT` itself rather than the project directory.
resolveLoader: {
modules: [
// Resolve loaders from the project directory. This is used for Origami Build Service as dependencies are
// flattened by npm which causes the loaders to not be found.
appRoot + '/node_modules',
// Fallback to resolving loaders from OBT's node_modules folder if it has one. In most cases this is the
// resolver that will return the loaders.
path.resolve(__dirname, '../node_modules'),
'node_modules',
'bower_components'
Expand Down
97 changes: 73 additions & 24 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"dependencies": {
"aliases": "^0.1.0",
"app-root-path": "^2.0.1",
"autoprefixer": "^7.1.5",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
Expand Down

0 comments on commit e0b909d

Please sign in to comment.