Skip to content

Commit

Permalink
fix(compiler): add default export support and enable strict mode (#1175)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmdartus authored Apr 23, 2019
1 parent 26344d6 commit a429824
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 8 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/@lwc/compiler/src/__tests__/regression.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { readFixture, pretify } from './utils';
describe('regression test', () => {
it('#743 - Object rest spread throwing', async () => {
const actual = `const base = { foo: true }; const res = { ...base, bar: false };`;
const expected = `define('x/foo', function () {
const expected = `define('x/foo', function () { 'use strict';
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
Expand Down
2 changes: 0 additions & 2 deletions packages/@lwc/compiler/src/bundler/bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ export async function bundle(options: NormalizedCompilerOptions): Promise<Bundle

const { output } = await rollupBundler.generate({
amd: { id: namespace + '/' + name },
interop: false,
strict: false,
sourcemap: outputConfig.sourcemap,
format,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('module resolver', () => {

expect(success).toBe(true);
expect(pretify(result.code)).toBe(
pretify(`define('x/class_and_template', ['lwc'], function (lwc) {
pretify(`define('x/class_and_template', ['lwc'], function (lwc) { 'use strict';
function tmpl($api, $cmp, $slotset, $ctx) {
const {
t: api_text,
Expand Down Expand Up @@ -90,7 +90,7 @@ describe('module resolver', () => {
const { success, result } = await compile(noOutputConfig);
expect(success).toBe(true);
expect(pretify(result.code)).toBe(
pretify(`define('x/class_and_template', ['lwc'], function (lwc) {
pretify(`define('x/class_and_template', ['lwc'], function (lwc) { 'use strict';
function tmpl($api, $cmp, $slotset, $ctx) {
const {
t: api_text,
Expand Down

0 comments on commit a429824

Please sign in to comment.