feat: attach ts-loader options on build.loaders.ts (#4572)

This commit is contained in:
Xin Du (Clark) 2018-12-17 15:45:01 +00:00 committed by GitHub
parent 75e3df6be5
commit d723e49b2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View File

@ -43,6 +43,10 @@ export default () => ({
}, },
scss: {}, scss: {},
stylus: {}, stylus: {},
ts: {
transpileOnly: true,
appendTsSuffixTo: [/\.vue$/]
},
vueStyle: {} vueStyle: {}
}, },
styleResources: {}, styleResources: {},

View File

@ -233,10 +233,7 @@ export default class WebpackBaseConfig {
{ {
test: /\.ts$/, test: /\.ts$/,
loader: 'ts-loader', loader: 'ts-loader',
options: { options: this.loaders.ts
transpileOnly: true,
appendTsSuffixTo: [/\.vue$/]
}
}, },
{ {
test: /\.css$/, test: /\.css$/,

View File

@ -80,10 +80,10 @@ describe('basic dev', () => {
}) })
test('Config: build.loaders', () => { test('Config: build.loaders', () => {
expect(Object.keys(loadersOptions)).toHaveLength(12) expect(Object.keys(loadersOptions)).toHaveLength(13)
expect(loadersOptions).toHaveProperty( expect(loadersOptions).toHaveProperty(
'file', 'fontUrl', 'imgUrl', 'pugPlain', 'vue', 'file', 'fontUrl', 'imgUrl', 'pugPlain', 'vue',
'css', 'cssModules', 'less', 'sass', 'scss', 'stylus', 'vueStyle' 'css', 'cssModules', 'less', 'sass', 'scss', 'stylus', 'ts', 'vueStyle'
) )
const { cssModules, vue } = loadersOptions const { cssModules, vue } = loadersOptions
expect(cssModules.localIdentName).toBe('[hash:base64:6]') expect(cssModules.localIdentName).toBe('[hash:base64:6]')