@@ -12,15 +12,15 @@ var ExtractTextPlugin = require("extract-text-webpack-plugin")
12
12
var compiler = require ( '../lib/template-compiler' )
13
13
var normalizeNewline = require ( 'normalize-newline' )
14
14
15
- var loaderPath = 'expose?vueModule!' + path . resolve ( __dirname , '../' )
15
+ var loaderPath = 'expose-loader ?vueModule!' + path . resolve ( __dirname , '../index.js ' )
16
16
var mfs = new MemoryFS ( )
17
17
var globalConfig = {
18
18
output : {
19
19
path : '/' ,
20
20
filename : 'test.build.js'
21
21
} ,
22
22
module : {
23
- loaders : [
23
+ rules : [
24
24
{
25
25
test : / \. v u e $ / ,
26
26
loader : loaderPath
@@ -30,7 +30,17 @@ var globalConfig = {
30
30
}
31
31
32
32
function bundle ( options , cb ) {
33
+ var vueOptions = options . vue
34
+ delete options . vue
33
35
var config = Object . assign ( { } , globalConfig , options )
36
+
37
+ // assign vue Options
38
+ if ( vueOptions ) {
39
+ config . plugins = ( config . plugins || [ ] ) . concat ( new webpack . LoaderOptionsPlugin ( {
40
+ vue : vueOptions
41
+ } ) )
42
+ }
43
+
34
44
var webpackCompiler = webpack ( config )
35
45
webpackCompiler . outputFileSystem = mfs
36
46
webpackCompiler . run ( function ( err , stats ) {
@@ -250,8 +260,8 @@ describe('vue-loader', function () {
250
260
entry : './test/fixtures/extract-css.vue' ,
251
261
vue : {
252
262
loaders : {
253
- css : ExtractTextPlugin . extract ( 'css' ) ,
254
- stylus : ExtractTextPlugin . extract ( 'css?sourceMap!stylus' )
263
+ css : ExtractTextPlugin . extract ( 'css-loader ' ) ,
264
+ stylus : ExtractTextPlugin . extract ( 'css-loader ?sourceMap!stylus-loader ' )
255
265
}
256
266
} ,
257
267
plugins : [
@@ -269,6 +279,7 @@ describe('vue-loader', function () {
269
279
test ( {
270
280
entry : './test/fixtures/inject.js'
271
281
} , function ( window ) {
282
+ // console.log(window.injector.toString())
272
283
var module = interopDefault ( window . injector ( {
273
284
'./service' : {
274
285
msg : 'Hello from mocked service!'
@@ -292,7 +303,7 @@ describe('vue-loader', function () {
292
303
}
293
304
} ,
294
305
module : {
295
- loaders : [
306
+ rules : [
296
307
{ test : / \. v u e $ / , loader : loaderPath } ,
297
308
{ test : / \. p n g $ / , loader : 'file-loader?name=[name].[hash:6].[ext]' }
298
309
]
0 commit comments