Skip to content

Commit

Permalink
Fix local loader cann't be resolve.
Browse files Browse the repository at this point in the history
  • Loading branch information
erha19 committed Feb 4, 2018
1 parent e4a525a commit 346f7c3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion npm-shrinkwrap.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "weex-builder",
"version": "0.3.12",
"version": "0.3.13",
"main": "index.js",
"bin": "bin/weex-builder.js",
"repository": {
Expand Down
8 changes: 3 additions & 5 deletions src/weexBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ const utils = require('./utils');

class WeexBuilder extends WebpackBuilder {
constructor (source, dest, options = {}) {
if (options.ext && typeof options.ext === 'string') {
options.ext = options.ext.split(/,|\|/).filter(e => defaultExt.indexOf(e) === -1).concat(defaultExt).join('|');
}
else {
if (!(options.ext && typeof options.ext === 'string')) {
options.ext = defaultExt.join('|');
}

super(source, dest, options);
}
initConfig () {
Expand Down Expand Up @@ -114,7 +112,7 @@ class WeexBuilder extends WebpackBuilder {
* See: https://webpack.js.org/configuration/resolve/#resolveloader
*/
resolveLoader: {
modules: [path.join(__dirname, '../node_modules')],
modules: [path.join(__dirname, '../node_modules'), path.resolve('node_modules')],
extensions: ['.js', '.json'],
mainFields: ['loader', 'main'],
moduleExtensions: ['-loader']
Expand Down

0 comments on commit 346f7c3

Please sign in to comment.