Skip to content

Commit

Permalink
fix: client render entry error for babel-loader path
Browse files Browse the repository at this point in the history
  • Loading branch information
hubcarl committed Nov 1, 2018
1 parent 701a817 commit c9c15fd
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
5 changes: 2 additions & 3 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ class WebpackClientBuilder extends WebpackBaseBuilder {
// 如果存在同名 html 模板文件, 全局 template 配置非必须
globalTemplate = globalTemplate && this.utils.normalizePath(globalTemplate, config.baseDir);

const entry = this.utils.getEntry(config, this.type);

let deps;
if (this.config.dll) {
const manifest = this.getPluginByName('manifest');
Expand All @@ -110,6 +108,8 @@ class WebpackClientBuilder extends WebpackBaseBuilder {
deps = require(filepath).deps;
}
}
const entry = this.webpackConfig.entry;

Object.keys(entry).forEach(entryName => {
const entryFile = (Array.isArray(entry[entryName]) ? entry[entryName].slice(-1)[0] : entry[entryName])
.replace(/^.*!/, ''); // 提取'xx-loader!index.vue'后面的路径
Expand All @@ -136,7 +136,6 @@ class WebpackClientBuilder extends WebpackBaseBuilder {
this.plugins[entryName] = this.merge({ args: { minify, chunks, filename, template, css, js } }, plugin);
}
});
this.addEntry(entry);
}
}
this.removePlugin('html'); // remove html single config
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "easywebpack",
"version": "4.9.0",
"version": "4.9.1",
"description": "基于 Webpack 的前端构建工程化解决方案",
"keywords": [
"webpack",
Expand Down
2 changes: 0 additions & 2 deletions test/client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,8 @@ describe('client.test.js', () => {
const webpackConfig = builder.create();
const tsLoader = getLoaderByName('ts', webpackConfig.module.rules);
const tslint = getLoaderByName('tslint', webpackConfig.module.rules);
const eslint = getLoaderByName('eslint', webpackConfig.module.rules);
expect(tsLoader).to.be.undefined;
expect(tslint).to.be.undefined;
expect(eslint.use[0].loader).to.equal('eslint-loader');
});

it('should typescript cache enable test', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/loader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('loader.test.js', () => {
const builder1 = createBuilder();
const webpackConfig1 = builder1.create();
const rules1 = webpackConfig1.module.rules;
expect(getLoaderByName('eslint', rules1)).to.include.all.keys(['test', 'use']);
expect(getLoaderByName('eslint', rules1)).to.be.undefined;
expect(getLoaderByName('babel', rules1)).to.include.all.keys(['test', 'use']);
expect(getLoaderByTest(/\.(woff2?|eot|ttf|otf)(\?.*)?$/, rules1)).to.include.all.keys(['test', 'use']);

Expand Down

0 comments on commit c9c15fd

Please sign in to comment.