fix(js): generate correct build options for rollup bundler; by defaul… (#15184)
This commit is contained in:
parent
16023ea679
commit
2f4f28760f
@ -810,6 +810,35 @@ describe('lib', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('bundler=rollup', () => {
|
||||
it('should generate correct options for build', async () => {
|
||||
await libraryGenerator(tree, {
|
||||
...defaultOptions,
|
||||
name: 'myLib',
|
||||
buildable: true,
|
||||
bundler: 'rollup',
|
||||
});
|
||||
|
||||
const config = readProjectConfiguration(tree, 'my-lib');
|
||||
expect(config.targets.build.options.project).toEqual(
|
||||
`libs/my-lib/package.json`
|
||||
);
|
||||
});
|
||||
|
||||
it('should set compiler to swc', async () => {
|
||||
await libraryGenerator(tree, {
|
||||
...defaultOptions,
|
||||
name: 'myLib',
|
||||
buildable: true,
|
||||
bundler: 'rollup',
|
||||
compiler: 'swc',
|
||||
});
|
||||
|
||||
const config = readProjectConfiguration(tree, 'my-lib');
|
||||
expect(config.targets.build.options.compiler).toEqual('swc');
|
||||
});
|
||||
});
|
||||
|
||||
describe('--publishable', () => {
|
||||
it('should generate the build target', async () => {
|
||||
await libraryGenerator(tree, {
|
||||
|
||||
@ -83,7 +83,7 @@ export async function projectGenerator(
|
||||
});
|
||||
tasks.push(viteTask);
|
||||
}
|
||||
if (schema.bundler === 'rollup') {
|
||||
if (options.bundler === 'rollup') {
|
||||
ensureBabelRootConfigExists(tree);
|
||||
}
|
||||
|
||||
@ -160,6 +160,13 @@ function addProject(
|
||||
},
|
||||
};
|
||||
|
||||
if (options.bundler === 'rollup') {
|
||||
projectConfiguration.targets.build.options.project = `${options.projectRoot}/package.json`;
|
||||
if (options.compiler === 'swc') {
|
||||
projectConfiguration.targets.build.options.compiler = 'swc';
|
||||
}
|
||||
}
|
||||
|
||||
if (options.compiler === 'swc' && options.skipTypeCheck) {
|
||||
projectConfiguration.targets.build.options.skipTypeCheck = true;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user