Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write sourcemaps for the serve mode's default target again #4569

Merged
merged 3 commits into from
May 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/core/core/src/TargetResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export default class TargetResolver {
name: 'default',
distDir: this.options.distDir,
publicUrl: this.options.publicUrl ?? '/',
sourceMap: this.options.sourceMaps ? {} : undefined,
env: createEnvironment({
context: 'browser',
engines: {
Expand Down
38 changes: 38 additions & 0 deletions packages/core/core/test/TargetResolver.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,44 @@ describe('TargetResolver', () => {
);
});

it('generates a default target in serve mode', async () => {
let targetResolver = new TargetResolver({
...DEFAULT_OPTIONS,
serve: {port: 1234},
});

assert.deepEqual(
await targetResolver.resolve(COMMON_TARGETS_FIXTURE_PATH),
{
targets: [
{
name: 'default',
distDir: DEFAULT_OPTIONS.distDir,
publicUrl: '/',
env: {
context: 'browser',
engines: {
browsers: [
'last 1 Chrome version',
'last 1 Safari version',
'last 1 Firefox version',
'last 1 Edge version',
],
},
includeNodeModules: true,
outputFormat: 'global',
isLibrary: false,
minify: false,
scopeHoist: false,
},
sourceMap: {},
},
],
files: [],
},
);
});

it('rejects invalid or unknown fields', async () => {
let code =
'{\n' +
Expand Down