mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 23:52:06 +00:00
feat(nuxt-ts): typescript support improvements (#4750)
This commit is contained in:
parent
8c915887f4
commit
dfaffc0183
@ -1,9 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"lib": ["es2015", "dom"],
|
||||
"lib": ["esnext", "esnext.asynciterable", "dom"],
|
||||
"esModuleInterop": true,
|
||||
"experimentalDecorators": true,
|
||||
"allowJs": true,
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"lib": ["es2015", "dom"],
|
||||
"lib": ["esnext", "esnext.asynciterable", "dom"],
|
||||
"esModuleInterop": true,
|
||||
"experimentalDecorators": true,
|
||||
"allowJs": true,
|
||||
|
@ -9,7 +9,7 @@ import chalk from 'chalk'
|
||||
import prettyBytes from 'pretty-bytes'
|
||||
import env from 'std-env'
|
||||
|
||||
export const requireModule = esm(module, {
|
||||
export const requireModule = process.env.NUXT_TS ? require : esm(module, {
|
||||
cache: false,
|
||||
cjs: {
|
||||
cache: true,
|
||||
|
@ -185,6 +185,10 @@ export default class WebpackBaseConfig {
|
||||
this.nuxt,
|
||||
{ isServer: this.isServer, perfLoader }
|
||||
)
|
||||
const babelLoader = {
|
||||
loader: require.resolve('babel-loader'),
|
||||
options: this.getBabelOptions()
|
||||
}
|
||||
|
||||
return [
|
||||
{
|
||||
@ -224,23 +228,22 @@ export default class WebpackBaseConfig {
|
||||
// item in transpile can be string or regex object
|
||||
return !this.modulesToTranspile.some(module => module.test(file))
|
||||
},
|
||||
use: perfLoader.js().concat({
|
||||
loader: require.resolve('babel-loader'),
|
||||
options: this.getBabelOptions()
|
||||
})
|
||||
use: perfLoader.js().concat(babelLoader)
|
||||
},
|
||||
{
|
||||
test: /\.ts$/i,
|
||||
loader: 'ts-loader',
|
||||
options: this.loaders.ts
|
||||
use: [
|
||||
babelLoader,
|
||||
{
|
||||
loader: 'ts-loader',
|
||||
options: this.loaders.ts
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.tsx$/i,
|
||||
use: [
|
||||
{
|
||||
loader: require.resolve('babel-loader'),
|
||||
options: this.getBabelOptions()
|
||||
},
|
||||
babelLoader,
|
||||
{
|
||||
loader: 'ts-loader',
|
||||
options: this.loaders.tsx
|
||||
|
2
test/fixtures/typescript/tsconfig.json
vendored
2
test/fixtures/typescript/tsconfig.json
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"lib": ["esnext", "esnext.asynciterable", "dom"],
|
||||
|
Loading…
Reference in New Issue
Block a user