-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #382 from meandmax/build-setup-and-fix-jQuery-bug
Make development more convient - fix jQuery reference error
- Loading branch information
Showing
39 changed files
with
242 additions
and
3,635 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import webpack from 'webpack'; | ||
import _debug from 'debug'; | ||
import fs from 'fs-extra'; | ||
import config from '../webpack.config.prod.js'; | ||
|
||
const debug = _debug('app:build:webpack-compiler'); | ||
|
||
const DEFAULT_STATS_FORMAT = { | ||
chunks : false, | ||
chunkModules : false, | ||
colors : true | ||
} | ||
|
||
function webpackCompiler (webpackConfig, statsFormat = DEFAULT_STATS_FORMAT) { | ||
return new Promise((resolve, reject) => { | ||
const compiler = webpack(webpackConfig); | ||
|
||
compiler.run((err, stats) => { | ||
const jsonStats = stats.toJson(); | ||
|
||
debug('Webpack compile completed.'); | ||
debug(stats.toString(statsFormat)); | ||
|
||
if (err) { | ||
debug('Webpack compiler encountered a fatal error.', err); | ||
return reject(err); | ||
} else if (jsonStats.errors.length > 0) { | ||
debug('Webpack compiler encountered errors.'); | ||
debug(jsonStats.errors.join('\n')); | ||
return reject(new Error('Webpack compiler encountered errors')); | ||
} else if (jsonStats.warnings.length > 0) { | ||
debug('Webpack compiler encountered warnings.'); | ||
debug(jsonStats.warnings.join('\n')); | ||
} else { | ||
debug('No errors or warnings encountered.'); | ||
} | ||
resolve(jsonStats); | ||
}); | ||
}); | ||
} | ||
|
||
;(async function () { | ||
try { | ||
debug('Run compiler'); | ||
const stats = await webpackCompiler(config); | ||
if (stats.warnings.length && config.compiler_fail_on_warning) { | ||
debug('Config set to fail on warning, exiting with status code "1".'); | ||
process.exit(1); | ||
} | ||
} catch (e) { | ||
debug('Compiler encountered an error.', e); | ||
process.exit(1); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import webpack from 'webpack'; | ||
import config from '../webpack.config.dev.js'; | ||
import WebpackDevServer from 'webpack-dev-server'; | ||
|
||
config.entry.app.unshift("webpack-dev-server/client?http://localhost:8080/", "webpack/hot/dev-server"); | ||
const compiler = webpack(config); | ||
const server = new WebpackDevServer(compiler, { | ||
hot: true | ||
}); | ||
|
||
server.listen(8080); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.