fix(expo): fix the buildable library (#14142)
This commit is contained in:
parent
02d1cc85ca
commit
74d8a4830e
@ -1,4 +1,5 @@
|
||||
import {
|
||||
checkFilesExist,
|
||||
cleanupProject,
|
||||
expectTestsPass,
|
||||
newProject,
|
||||
@ -47,4 +48,21 @@ describe('expo', () => {
|
||||
'Export was successful. Your exported files can be found'
|
||||
);
|
||||
}, 1000000);
|
||||
|
||||
it('should build publishable library', async () => {
|
||||
const libName = uniq('lib');
|
||||
const componentName = uniq('component');
|
||||
|
||||
runCLI(
|
||||
`generate @nrwl/expo:library ${libName} --buildable --publishable --importPath=${proj}/${libName}`
|
||||
);
|
||||
runCLI(
|
||||
`generate @nrwl/expo:component ${componentName} --project=${libName} --export`
|
||||
);
|
||||
expect(() => {
|
||||
runCLI(`build ${libName}`);
|
||||
checkFilesExist(`dist/libs/${libName}/index.js`);
|
||||
checkFilesExist(`dist/libs/${libName}/src/index.d.ts`);
|
||||
}).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
{
|
||||
"presets": [
|
||||
[
|
||||
"@nrwl/react/babel",
|
||||
{
|
||||
"runtime": "automatic",
|
||||
"useBuiltIns": "usage"
|
||||
}
|
||||
]
|
||||
],
|
||||
"plugins": [],
|
||||
"env": {
|
||||
"test": {
|
||||
"presets": ["babel-preset-expo"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -235,7 +235,7 @@ describe('lib', () => {
|
||||
executor: '@nrwl/web:rollup',
|
||||
outputs: ['{options.outputPath}'],
|
||||
options: {
|
||||
external: ['react/jsx-runtime'],
|
||||
external: ['react/jsx-runtime', 'react-native'],
|
||||
entryFile: 'libs/my-lib/src/index.ts',
|
||||
outputPath: 'dist/libs/my-lib',
|
||||
project: 'libs/my-lib/package.json',
|
||||
|
||||
@ -79,7 +79,7 @@ function addProject(host: Tree, options: NormalizedSchema) {
|
||||
|
||||
if (options.publishable || options.buildable) {
|
||||
const { libsDir } = getWorkspaceLayout(host);
|
||||
const external = ['react/jsx-runtime'];
|
||||
const external = ['react/jsx-runtime', 'react-native'];
|
||||
|
||||
targets.build = {
|
||||
executor: '@nrwl/web:rollup',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user