Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
.travis.yml
src
test
*.tgz
20 changes: 10 additions & 10 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class ClientJS extends NxusModule {
*/
includeScript(templateName, script) {
let scriptName = path.basename(script)
let outputPath = path.join(morph.toDashed(templateName), scriptName)
let outputPath = scriptName

let imports = [], headScripts = []

Expand Down Expand Up @@ -213,7 +213,6 @@ class ClientJS extends NxusModule {
_establishRoute(route, path) {
fs.ensureDirSync(path) //create directory if it doesn't exist
if (!(path in this._outputPaths)) {
this._outputPaths[path] = true
router.staticRoute(route, path)
}
}
Expand Down Expand Up @@ -327,11 +326,10 @@ class ClientJS extends NxusModule {
var outputFile = this.config.assetFolder+output
var outputFilename = path.basename(outputFile)

this._establishRoute(outputRoute, outputPath)

var options = this._webpackConfig(entry, outputPath, outputFilename)

let promise = new Promise((resolve, reject) => {
let promise = this._outputPaths[outputFile]
if (!promise) {
promise = new Promise((resolve, reject) => {
var options = this._webpackConfig(entry, outputPath, outputFilename)
webpack(options, (err, stats) => {
if (err) {
this.log.error(`Bundle error for ${entry}`, err)
Expand All @@ -356,11 +354,13 @@ class ClientJS extends NxusModule {
this.log.debug(`Bundle for ${entry} written to ${outputFile}`)
resolve()
})
})

})
this._establishRoute(outputRoute, outputPath)
this._outputPaths[outputFile] = promise

}
return promise
}

}


Expand Down
2 changes: 1 addition & 1 deletion src/test/data/bundle/one-bundled.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/test/data/bundle/one-bundled.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/test/data/bundle/two-bundled.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/test/data/bundle/two-bundled.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/test/data/script/one.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading