Skip to content

Commit

Permalink
fix: exports field build error in webpack4
Browse files Browse the repository at this point in the history
  • Loading branch information
SoloJiang committed Apr 21, 2022
1 parent b62b547 commit 8f38ae7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
## Changelog

## 3.8.16

- Fix: exports field build error in webpack4

## 3.8.15

- Chore: update @builder/pack to 0.6.x, more detail see https://github.com/ice-lab/builder-deps/pull/20
- Feat: change the way of options pass into postcss-loader because the update of it

## 3.8.14

Expand Down
4 changes: 4 additions & 0 deletions packages/plugin-rax-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 7.0.10

- Fix: resolve error with `import` in webpack4

## 7.0.9

- Fix: the way of options pass into `postcss-loader` because the update of `postcss-loader`
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-rax-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-rax-app",
"version": "7.0.9",
"version": "7.0.10",
"description": "The basic webpack configuration for rax project",
"author": "Rax Team",
"main": "lib/index.js",
Expand Down Expand Up @@ -52,4 +52,4 @@
"url": "[email protected]:raxjs/rax-app.git"
},
"gitHead": "07ac7bb07162aac8c90778dd1de4a2060f8df498"
}
}
8 changes: 4 additions & 4 deletions packages/plugin-rax-app/src/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,12 @@ module.exports = (api, { target, babelConfigOptions, progressOptions = {} }) =>
});
}

const conditionNames = [target, '...'];

// Add condition names
if (isWebpack4) {
config.plugin('ExportsFieldWebpackPlugin').use(ExportsFieldWebpackPlugin, [
{
conditionNames,
// In webpack4, import, require, node for fallback
conditionNames: [target, 'import', 'require', 'node'],
},
]);
// Set dev server content base
Expand All @@ -122,7 +121,8 @@ module.exports = (api, { target, babelConfigOptions, progressOptions = {} }) =>
config.target('web');
} else {
config.resolve.merge({
conditionNames,
// Webpack5+ will dynamic return default value with ..., which depends on build task target
conditionNames: [target, '...'],
});

// Set dev server content base
Expand Down
6 changes: 3 additions & 3 deletions packages/rax-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rax-app",
"version": "3.8.15",
"version": "3.8.16",
"description": "command line interface and builtin plugin for rax app",
"author": "Rax Team",
"homepage": "https://github.com/raxjs/rax-app#readme",
Expand All @@ -18,7 +18,7 @@
"build-scripts": "^1.1.0",
"build-plugin-app-core": "2.1.0",
"build-plugin-ice-config": "2.0.2",
"build-plugin-rax-app": "7.0.9",
"build-plugin-rax-app": "7.0.10",
"build-plugin-rax-kraken": "2.1.1",
"build-plugin-rax-miniapp": "2.0.2",
"build-plugin-rax-pha": "2.1.1",
Expand Down Expand Up @@ -56,4 +56,4 @@
"node": ">=12.22.0",
"npm": ">=3.0.0"
}
}
}

0 comments on commit 8f38ae7

Please sign in to comment.