Skip to content

Commit

Permalink
chore: use resolve.alias instead of source.alias
Browse files Browse the repository at this point in the history
  • Loading branch information
Timeless0911 committed Dec 2, 2024
1 parent a5893be commit 11835fe
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
12 changes: 9 additions & 3 deletions packages/core/tests/__snapshots__/config.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,13 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config 1
"setup": [Function],
},
],
"source": {
"resolve": {
"alias": {
"bar": "bar",
"foo": "foo/esm",
},
},
"source": {
"entry": {},
"preEntry": "./b.js",
},
Expand Down Expand Up @@ -348,11 +350,13 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config 1
"setup": [Function],
},
],
"source": {
"resolve": {
"alias": {
"bar": "bar/cjs",
"foo": "foo",
},
},
"source": {
"entry": {},
"preEntry": [
"./a.js",
Expand Down Expand Up @@ -572,11 +576,13 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config 1
"setup": [Function],
},
],
"source": {
"resolve": {
"alias": {
"bar": "bar",
"foo": "foo",
},
},
"source": {
"entry": {},
"preEntry": "./a.js",
},
Expand Down
12 changes: 9 additions & 3 deletions packages/core/tests/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,31 +154,37 @@ describe('Should compose create Rsbuild config correctly', () => {
{
format: 'esm',
source: {
preEntry: './b.js',
},
resolve: {
alias: {
foo: 'foo/esm',
},
preEntry: './b.js',
},
},
{
format: 'cjs',
source: {
preEntry: ['./c.js', './d.js'],
},
resolve: {
alias: {
bar: 'bar/cjs',
},
preEntry: ['./c.js', './d.js'],
},
},
{
format: 'umd',
},
],
source: {
preEntry: './a.js',
},
resolve: {
alias: {
foo: 'foo',
bar: 'bar',
},
preEntry: './a.js',
},
output: {
filenameHash: false,
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/alias/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export default defineConfig({
entry: {
index: './src/index.ts',
},
},
resolve: {
alias: {
'@src': 'src',
},
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/style/less/bundle-false/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export default defineConfig({
entry: {
index: ['../__fixtures__/basic/src/**', '!../__fixtures__/**/*.d.ts'],
},
},
resolve: {
alias: {
'~': require('node:path').resolve(
__dirname,
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/style/less/bundle/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export default defineConfig({
entry: {
index: ['../__fixtures__/basic/src/index.less'],
},
},
resolve: {
alias: {
'~': require('node:path').resolve(
__dirname,
Expand Down

0 comments on commit 11835fe

Please sign in to comment.