@@ -6,6 +6,7 @@ const path = require('path')
66const node = require ( 'when/node' )
77const reshape = require ( 'reshape' )
88const loader = require ( 'reshape-loader' )
9+ const SpikeUtil = require ( 'spike-util' )
910
1011class Rooftop {
1112 constructor ( opts ) {
@@ -15,6 +16,7 @@ class Rooftop {
1516 }
1617
1718 apply ( compiler ) {
19+ this . util = new SpikeUtil ( compiler . options )
1820 compiler . plugin ( 'run' , this . run . bind ( this , compiler ) )
1921 compiler . plugin ( 'watch-run' , this . run . bind ( this , compiler ) )
2022 compiler . plugin ( 'emit' , ( compilation , done ) => {
@@ -31,7 +33,7 @@ class Rooftop {
3133 } )
3234
3335 W . map ( templateContent , ( ct ) => {
34- return writeTemplate ( ct , compiler , compilation , this . addDataTo , done )
36+ return writeTemplate . call ( this , ct , compiler , compilation , this . addDataTo , done )
3537 } ) . done ( ( ) => done ( ) , done )
3638 } )
3739 }
@@ -155,7 +157,7 @@ function writeTemplate (ct, compiler, compilation, addDataTo, cb) {
155157 // webpack context is used by default in spike for plugins, so we need
156158 // to mock it so that plugins dont crash
157159 const fakeContext = { addDependency : ( x ) => x , resourcePath : filePath }
158- const options = loader . parseOptions . call ( fakeContext , compiler . options . reshape )
160+ const options = loader . parseOptions . call ( fakeContext , this . util . getSpikeOptions ( ) . reshape )
159161
160162 // W.map fires events as quickly as possible, so the locals will be
161163 // swapped for the last item unless bound to the result function
0 commit comments