Skip to content

Commit 8c6302c

Browse files
committed
feat(compile): 自动添加context为resolve.root
1 parent 39c8119 commit 8c6302c

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@qnpm/ykit",
3-
"version": "0.0.2",
3+
"version": "0.0.3dev",
44
"description": "高可用高扩展前端开发工具",
55
"main": "src/ykit.js",
66
"bin": {

src/models/Config.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ class Config {
2020
}
2121
},
2222
module: {
23-
preLoaders: [
24-
{ test: /\.js$/, loader: sysPath.resolve(__dirname, "./loader.js") }
25-
],
23+
preLoaders: [],
2624
loaders: [{
2725
test: /\.json$/,
2826
loader: require.resolve('json-loader')
@@ -35,16 +33,17 @@ class Config {
3533
require.resolve('style-loader'),
3634
require.resolve('css-loader')
3735
)
38-
}]
36+
}],
37+
postLoaders: []
3938
},
4039
plugins: [
4140
require('../plugins/extTemplatedPathPlugin.js'),
4241
require('../plugins/requireModulePlugin.js'),
4342
],
4443
resolve: {
45-
root: [sysPath.resolve(cwd, './src')],
44+
root: [],
4645
extensions: ['', '.js', '.css', '.json', '.string', '.tpl'],
47-
alias: {}
46+
alias: {},
4847
},
4948
entryExtNames: {
5049
css: ['.css'],
@@ -102,6 +101,8 @@ class Config {
102101
nextConfig.context = sysPath.resolve(this._config.cwd, nextConfig.context)
103102
}
104103

104+
this._config.resolve.root.push(nextConfig.context)
105+
105106
extend(true, this._config, nextConfig);
106107
}
107108
}

0 commit comments

Comments
 (0)