Skip to content

Commit c76f5e5

Browse files
committed
fix: disable esModuleInterop & allowSyntheticDefaultImports for TS
Otherwise the emitted type definitions may break downstream users who do not have these options enabled. Thanks @meteorlxy for spotting this issue.
1 parent 6ed553f commit c76f5e5

12 files changed

+26
-26
lines changed

src/formatError.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { generateCodeFrame, CompilerError } from '@vue/compiler-sfc'
2-
import chalk from 'chalk'
2+
import chalk = require('chalk')
33

44
export function formatError(
55
err: SyntaxError | CompilerError,

src/index.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ try {
77
)
88
}
99

10-
import webpack from 'webpack'
11-
import path from 'path'
12-
import qs from 'querystring'
13-
import hash from 'hash-sum'
14-
import loaderUtils from 'loader-utils'
10+
import webpack = require('webpack')
11+
import * as path from 'path'
12+
import * as qs from 'querystring'
13+
import * as loaderUtils from 'loader-utils'
14+
15+
import hash = require('hash-sum')
16+
1517
import {
1618
parse,
1719
compileScript,

src/pitcher.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import webpack from 'webpack'
2-
import qs from 'querystring'
3-
import loaderUtils from 'loader-utils'
1+
import webpack = require('webpack')
2+
import * as qs from 'querystring'
3+
import * as loaderUtils from 'loader-utils'
44

55
const selfPath = require.resolve('./index')
66
// const templateLoaderPath = require.resolve('./templateLoader')
@@ -69,7 +69,7 @@ export const pitch = function () {
6969
return genProxyModule(
7070
[...afterLoaders, stylePostLoaderPath, ...beforeLoaders],
7171
context,
72-
!! query.module
72+
!!query.module
7373
)
7474
}
7575
}

src/plugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import webpack from 'webpack'
1+
import webpack = require('webpack')
22
declare class VueLoaderPlugin implements webpack.Plugin {
33
static NS: string
44
apply(compiler: webpack.Compiler): void

src/pluginWebpack4.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import qs from 'querystring'
2-
import webpack from 'webpack'
1+
import * as qs from 'querystring'
2+
import webpack = require('webpack')
33
import { VueLoaderOptions } from './'
44

55
const RuleSet = require('webpack/lib/RuleSet')

src/pluginWebpack5.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import qs from 'querystring'
1+
import * as qs from 'querystring'
22
import { VueLoaderOptions } from './'
33
import { RuleSetRule, Compiler, Plugin } from 'webpack'
44

src/select.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import webpack from 'webpack'
1+
import webpack = require('webpack')
22
import { SFCDescriptor } from '@vue/compiler-sfc'
33
import { ParsedUrlQuery } from 'querystring'
44

src/stylePostLoader.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import qs from 'querystring'
1+
import * as qs from 'querystring'
22
import { compileStyle } from '@vue/compiler-sfc'
3-
import webpack from 'webpack'
3+
import webpack = require('webpack')
44

55
// This is a post loader that handles scoped CSS transforms.
66
// Injected right before css-loader by the global pitcher (../pitch.js)

src/templateLoader.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import webpack from 'webpack'
2-
import qs from 'querystring'
3-
import loaderUtils from 'loader-utils'
1+
import webpack = require('webpack')
2+
import * as qs from 'querystring'
3+
import * as loaderUtils from 'loader-utils'
44
import { VueLoaderOptions } from './'
55
import { formatError } from './formatError'
66
import { compileTemplate, TemplateCompiler } from '@vue/compiler-sfc'

test/edgeCases.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as path from 'path'
2-
import HTMLPlugin from 'html-webpack-plugin'
2+
import HTMLPlugin = require('html-webpack-plugin')
33
import { mfs, bundle, mockBundleAndRun, normalizeNewline } from './utils'
44

55
// @ts-ignore

test/utils.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* env jest */
2-
import path from 'path'
3-
import webpack from 'webpack'
2+
import * as path from 'path'
3+
import webpack = require('webpack')
44
import merge from 'webpack-merge'
5-
import hash from 'hash-sum'
5+
import hash = require('hash-sum')
66
// import MiniCssExtractPlugin from 'mini-css-extract-plugin'
77
import { fs as mfs } from 'memfs'
88

tsconfig.json

-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66
"target": "es2015",
77
"module": "commonjs",
88
"moduleResolution": "node",
9-
"esModuleInterop": true,
109
"declaration": true,
1110
"allowJs": false,
12-
"allowSyntheticDefaultImports": true,
1311
"noUnusedLocals": true,
1412
"strictNullChecks": true,
1513
"noImplicitAny": true,

0 commit comments

Comments
 (0)