|
|
|
@ -165,6 +165,43 @@ describe("formats", () => {
|
|
|
|
|
});
|
|
|
|
|
}, /Missing required 'name' option for IIFE export/);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('suggests using options.globals for default imports', () => {
|
|
|
|
|
const warnings = [];
|
|
|
|
|
|
|
|
|
|
svelte.compile(`
|
|
|
|
|
<script>
|
|
|
|
|
import _ from 'lodash';
|
|
|
|
|
</script>
|
|
|
|
|
`,
|
|
|
|
|
{
|
|
|
|
|
format: 'iife',
|
|
|
|
|
name: 'App',
|
|
|
|
|
onwarn: warning => {
|
|
|
|
|
warnings.push(warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
assert.deepEqual(warnings, [{
|
|
|
|
|
message: `No name was supplied for imported module 'lodash'. Guessing '_', but you should use options.globals`
|
|
|
|
|
}]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('insists on options.globals for named imports', () => {
|
|
|
|
|
assert.throws(() => {
|
|
|
|
|
svelte.compile(`
|
|
|
|
|
<script>
|
|
|
|
|
import { fade } from 'svelte-transitions';
|
|
|
|
|
</script>
|
|
|
|
|
`,
|
|
|
|
|
{
|
|
|
|
|
format: 'iife',
|
|
|
|
|
name: 'App'
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}, /Could not determine name for imported module 'svelte-transitions' – use options.globals/);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe("umd", () => {
|
|
|
|
|