Improve building process (es6 bundle)

This commit is contained in:
RainLoop Team 2016-08-11 02:16:58 +03:00
parent 8967bc3817
commit 0a2b826f71
16 changed files with 1279 additions and 1317 deletions

View file

@ -1,10 +1,12 @@
# transifex
tx pull -a
# dependencies checker # dependencies checker
npm-check --skip-unused npm-check --skip-unused
# dependencies locker # dependencies locker
npm shrinkwrap --dev npm shrinkwrap --dev
# code validation # js code validation
gulp v gulp v

View file

@ -15,7 +15,8 @@ module.exports = {
'browser': true 'browser': true
}, },
'globals': { 'globals': {
'RL_COMMUNITY': true 'RL_COMMUNITY': true,
'RL_ES6': true
}, },
// http://eslint.org/docs/rules/ // http://eslint.org/docs/rules/
'rules': { 'rules': {

View file

@ -1 +0,0 @@
tx pull -a

View file

@ -17,6 +17,46 @@ window.__rlah_clear = () => clearHash();
window.__rlah_data = () => RL_APP_DATA_STORAGE; window.__rlah_data = () => RL_APP_DATA_STORAGE;
/* eslint-enable */ /* eslint-enable */
const useJsNextBundle = (function() {
if (!RL_ES6)
{
return false;
}
/* eslint-disable */
try {
eval(`
// let + const
const x = 5; let y = 4; var z = 4;
// Arrow Function
const f = () => 'rainloop';
// Default + Rest + Spread
const d = (test = 1, ...t) => 'rainloop';
d(...[1, 2, 3]);
// Destructuring
let [a, b] = [1, 2];
({a, b} = {a: 1, b: 2});
// Class
class Q1 { constructor() {} }
// Class extends + super
class Q2 extends Q1 { constructor() { super() } }
`);
return true;
}
catch (e) {}
return false;
/* eslint-enable */
}());
/** /**
* @param {string} id * @param {string} id
* @param {string} name * @param {string} name
@ -184,7 +224,7 @@ function runApp()
const appData = window.__rlah_data(); const appData = window.__rlah_data();
if (window.jassl && progressJs && appData && appData.TemplatesLink && appData.LangLink && if (window.jassl && progressJs && appData && appData.TemplatesLink && appData.LangLink &&
appData.StaticLibJsLink && appData.StaticAppJsLink && appData.StaticEditorJsLink) appData.StaticLibJsLink && appData.StaticAppJsLink && appData.StaticAppJsNextLink && appData.StaticEditorJsLink)
{ {
const p = progressJs; const p = progressJs;
@ -214,7 +254,7 @@ function runApp()
Promise.all([libs, common]) Promise.all([libs, common])
.then(() => { .then(() => {
p.set(30); p.set(30);
return window.jassl(appData.StaticAppJsLink); return window.jassl(useJsNextBundle ? appData.StaticAppJsNextLink : appData.StaticAppJsLink);
}) })
.then(() => { .then(() => {
p.set(50); p.set(50);
@ -280,12 +320,17 @@ window.__runBoot = function() {
window.document.location.replace('./?/NoCookie'); window.document.location.replace('./?/NoCookie');
} }
const root = document.documentElement;
if ('none' !== getComputedStyle('rl-check', 'display')) if ('none' !== getComputedStyle('rl-check', 'display'))
{ {
const root = document.documentElement;
root.className += ' no-css'; root.className += ' no-css';
} }
if (useJsNextBundle)
{
root.className += ' js-next';
}
if (includeLayout()) if (includeLayout())
{ {
includeAppScr(getRainloopBootData()); includeAppScr(getRainloopBootData());

View file

@ -1,9 +1,9 @@
import window from 'window';
import _ from '_';
import ko from 'ko';
var var
window = require('window'),
_ = require('_'),
ko = require('ko'),
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Links = require('Common/Links'), Links = require('Common/Links'),

View file

@ -22,20 +22,17 @@ var
zipFile: '', zipFile: '',
zipFileShort: '', zipFileShort: '',
paths: {}, paths: {}
uglify: {
mangle: true,
compress: true
}
}, },
_ = require('lodash'), _ = require('lodash'),
fs = require('node-fs'), fs = require('node-fs'),
path = require('path'), path = require('path'),
notifier = require('node-notifier'), notifier = require('node-notifier'),
runSequence = require('run-sequence'),
webpack = require('webpack'), webpack = require('webpack'),
webpackCfg = require('./webpack.config.js'), webpackCfgBuilder = require('./webpack.config.builder.js'),
argv = require('yargs').argv, argv = require('yargs').argv,
@ -53,26 +50,69 @@ var
livereload = require('gulp-livereload'), livereload = require('gulp-livereload'),
eslint = require('gulp-eslint'), eslint = require('gulp-eslint'),
cache = require('gulp-cached'), cache = require('gulp-cached'),
ignore = require('gulp-ignore'),
filter = require('gulp-filter'),
gutil = require('gulp-util') gutil = require('gulp-util')
; ;
cfg.community = !argv.pro; cfg.community = !argv.pro;
cfg.next = !!argv.next;
// webpack // webpack
if (webpackCfg && webpackCfg.output) function initWebpackCfg(wpCfg)
{ {
webpackCfg.output.publicPath = cfg.paths.staticJS; if (wpCfg)
{
if (wpCfg.output)
{
wpCfg.output.publicPath = cfg.paths.staticJS;
} }
if (webpackCfg && webpackCfg.plugins) if (wpCfg.plugins)
{ {
webpackCfg.plugins.push(new webpack.DefinePlugin({ wpCfg.plugins.push(new webpack.DefinePlugin({
'RL_COMMUNITY': !!cfg.community, 'RL_COMMUNITY': cfg.community,
'RL_ES6': cfg.next,
'process.env': { 'process.env': {
NODE_ENV: '"production"' NODE_ENV: '"production"'
} }
})); }));
} }
}
return wpCfg;
}
function webpackCallback(callback)
{
return function(err, stats) {
if (err)
{
if (cfg.watch)
{
webpackError(err);
}
else
{
throw new gutil.PluginError('webpack', err);
}
}
else if (stats && stats.compilation && stats.compilation.errors && stats.compilation.errors[0])
{
if (cfg.watch)
{
_.each(stats.compilation.errors, webpackError);
}
else
{
throw new gutil.PluginError('webpack', stats.compilation.errors[0]);
}
}
callback();
};
}
function webpackError(err) { function webpackError(err) {
if (err) if (err)
@ -95,18 +135,6 @@ function getHead()
return !cfg.community ? head.rainloop : head.agpl; return !cfg.community ? head.rainloop : head.agpl;
} }
function regOtherMinTask(sName, sPath, sInc, sOut, sHeader)
{
gulp.task(sName, function() {
return gulp.src(sPath + sInc)
.pipe(uglify())
.pipe(header(sHeader || ''))
.pipe(rename(sOut))
.pipe(eol('\n', true))
.pipe(gulp.dest(sPath));
});
}
function zipDir(sSrcDir, sDestDir, sFileName) function zipDir(sSrcDir, sDestDir, sFileName)
{ {
return gulp.src(sSrcDir + '**/*') return gulp.src(sSrcDir + '**/*')
@ -170,7 +198,6 @@ cfg.paths.momentLocales = 'rainloop/v/' + cfg.devVersion + '/app/localization/mo
cfg.paths.less = { cfg.paths.less = {
main: { main: {
name: 'less.css',
src: 'dev/Styles/@Main.less', src: 'dev/Styles/@Main.less',
watch: ['dev/Styles/*.less'], watch: ['dev/Styles/*.less'],
options: { options: {
@ -198,8 +225,7 @@ cfg.paths.css = {
'node_modules/lightgallery/dist/css/lightgallery.min.css', 'node_modules/lightgallery/dist/css/lightgallery.min.css',
'node_modules/lightgallery/dist/css/lg-transitions.min.css', 'node_modules/lightgallery/dist/css/lg-transitions.min.css',
'node_modules/Progress.js/minified/progressjs.min.css', 'node_modules/Progress.js/minified/progressjs.min.css',
'dev/Styles/_progressjs.css', 'dev/Styles/_progressjs.css'
cfg.paths.staticCSS + cfg.paths.less.main.name
] ]
}, },
social: { social: {
@ -278,48 +304,42 @@ cfg.paths.js = {
}; };
// CSS // CSS
gulp.task('less:main', function() {
var less = require('gulp-less');
return gulp.src(cfg.paths.less.main.src) gulp.task('css:clean', function() {
return cleanDir(cfg.paths.staticCSS + '/*.css');
});
gulp.task('css:main', function() {
var autoprefixer = require('gulp-autoprefixer'),
less = require('gulp-less'),
lessFilter = filter('**/*.less', {restore: true}),
src = cfg.paths.css.main.src.concat([cfg.paths.less.main.src]);
return gulp.src(src)
.pipe(lessFilter)
.pipe(gulpif(cfg.watch, plumber({errorHandler: notify.onError("Error: <%= error.message %>")}))) .pipe(gulpif(cfg.watch, plumber({errorHandler: notify.onError("Error: <%= error.message %>")})))
.pipe(less({ .pipe(less({
'paths': cfg.paths.less.main.options.paths 'paths': cfg.paths.less.main.options.paths
})) }))
.pipe(rename(cfg.paths.less.main.name)) .pipe(lessFilter.restore)
.pipe(eol('\n', true))
.pipe(gulp.dest(cfg.paths.staticCSS))
.on('error', gutil.log);
});
gulp.task('css:social', function() {
var autoprefixer = require('gulp-autoprefixer');
return gulp.src(cfg.paths.css.social.src)
.pipe(concat(cfg.paths.css.social.name))
.pipe(autoprefixer('last 3 versions', '> 1%', 'ie 9', 'Firefox ESR', 'Opera 12.1'))
.pipe(replace(/\.\.\/(img|images|fonts|svg)\//g, '$1/'))
.pipe(eol('\n', true))
.pipe(gulp.dest(cfg.paths.staticCSS));
});
gulp.task('css:main-begin', ['less:main', 'css:social'], function() {
var autoprefixer = require('gulp-autoprefixer');
return gulp.src(cfg.paths.css.main.src)
.pipe(concat(cfg.paths.css.main.name)) .pipe(concat(cfg.paths.css.main.name))
.pipe(autoprefixer('last 3 versions', '> 1%', 'ie 9', 'Firefox ESR', 'Opera 12.1')) .pipe(autoprefixer('last 3 versions', '> 1%', 'ie 9', 'ie 10', 'ie 11', 'Firefox ESR'))
.pipe(replace(/\.\.\/(img|images|fonts|svg)\//g, '$1/')) .pipe(replace(/\.\.\/(img|images|fonts|svg)\//g, '$1/'))
.pipe(eol('\n', true)) .pipe(eol('\n', true))
.pipe(gulp.dest(cfg.paths.staticCSS)) .pipe(gulp.dest(cfg.paths.staticCSS))
.pipe(livereload()); .pipe(livereload());
}); });
gulp.task('css:clear-less', ['css:main-begin'], function() { gulp.task('css:social', function() {
return gulp.src(cfg.paths.staticCSS + cfg.paths.less.main.name, {read: false}) var autoprefixer = require('gulp-autoprefixer');
.pipe(require('gulp-rimraf')()); return gulp.src(cfg.paths.css.social.src)
.pipe(concat(cfg.paths.css.social.name))
.pipe(autoprefixer('last 3 versions', '> 1%', 'ie 9', 'ie 10', 'ie 11', 'Firefox ESR'))
.pipe(replace(/\.\.\/(img|images|fonts|svg)\//g, '$1/'))
.pipe(eol('\n', true))
.pipe(gulp.dest(cfg.paths.staticCSS));
}); });
gulp.task('css:main', ['css:clear-less']);
gulp.task('css:main:min', ['css:main'], function() { gulp.task('css:main:min', ['css:main'], function() {
var cleanCSS = require('gulp-clean-css'); var cleanCSS = require('gulp-clean-css');
return gulp.src(cfg.paths.staticCSS + cfg.paths.css.main.name) return gulp.src(cfg.paths.staticCSS + cfg.paths.css.main.name)
@ -355,11 +375,11 @@ gulp.task('js:openpgpworker', function() {
.pipe(gulp.dest(cfg.paths.staticMinJS)); .pipe(gulp.dest(cfg.paths.staticMinJS));
}); });
gulp.task('js:moment:locales-clear', function() { gulp.task('moment:locales-clear', function() {
return cleanDir('rainloop/v/' + cfg.devVersion + '/app/localization/moment/*.js'); return cleanDir('rainloop/v/' + cfg.devVersion + '/app/localization/moment/*.js');
}); });
gulp.task('js:moment:locales', ['js:moment:locales-clear'], function() { gulp.task('moment:locales', ['moment:locales-clear'], function() {
return gulp.src(cfg.paths.js.moment.locales) return gulp.src(cfg.paths.js.moment.locales)
.pipe(gulp.dest(cfg.paths.momentLocales)); .pipe(gulp.dest(cfg.paths.momentLocales));
}); });
@ -383,35 +403,26 @@ gulp.task('js:ckeditor:beautify', function() {
.pipe(gulp.dest(cfg.paths.static + 'ckeditor/')); .pipe(gulp.dest(cfg.paths.static + 'ckeditor/'));
}); });
gulp.task('js:webpack', function(callback) { gulp.task('js:clean', function() {
webpack(webpackCfg, function(err, stats) { return cleanDir(cfg.paths.staticJS + '/**/*.js');
});
if (err) gulp.task('js:webpack:main', function(callback) {
webpack(initWebpackCfg(webpackCfgBuilder()), webpackCallback(callback));
});
gulp.task('js:webpack:next', function(callback) {
if (cfg.next)
{ {
if (cfg.watch) webpack(initWebpackCfg(webpackCfgBuilder(true)), webpackCallback(callback));
{
webpackError(err);
} }
else else
{ {
throw new gutil.PluginError('webpack', err);
}
}
else if (stats && stats.compilation && stats.compilation.errors && stats.compilation.errors[0])
{
if (cfg.watch)
{
_.each(stats.compilation.errors, webpackError);
}
else
{
throw new gutil.PluginError('webpack', stats.compilation.errors[0]);
}
}
callback(); callback();
}
}); });
});
gulp.task('js:webpack', ['js:webpack:main', 'js:webpack:next']);
gulp.task('js:app', ['js:webpack'], function() { gulp.task('js:app', ['js:webpack'], function() {
return gulp.src(cfg.paths.staticJS + cfg.paths.js.app.name) return gulp.src(cfg.paths.staticJS + cfg.paths.js.app.name)
@ -432,8 +443,12 @@ gulp.task('js:admin', ['js:webpack'], function() {
// - min // - min
gulp.task('js:min', ['js:app', 'js:admin', 'js:validate'], function() { gulp.task('js:min', ['js:app', 'js:admin', 'js:validate'], function() {
return gulp.src(cfg.paths.staticJS + '*.js') return gulp.src(cfg.paths.staticJS + '*.js')
.pipe(ignore.exclude('*.next.js'))
.pipe(replace(/"rainloop\/v\/([^\/]+)\/static\/js\/"/g, '"rainloop/v/$1/static/js/min/"')) .pipe(replace(/"rainloop\/v\/([^\/]+)\/static\/js\/"/g, '"rainloop/v/$1/static/js/min/"'))
.pipe(uglify(cfg.uglify)) .pipe(uglify({
mangle: true,
compress: true
}))
.pipe(eol('\n', true)) .pipe(eol('\n', true))
.pipe(gulp.dest(cfg.paths.staticMinJS)) .pipe(gulp.dest(cfg.paths.staticMinJS))
.on('error', gutil.log); .on('error', gutil.log);
@ -640,10 +655,20 @@ gulp.task('rainloop:owncloud:shortname', ['rainloop:owncloud:zip'], function(cal
gulp.task('rainloop:owncloud:sign', ['rainloop:owncloud:shortname'], signFileTask); gulp.task('rainloop:owncloud:sign', ['rainloop:owncloud:shortname'], signFileTask);
// MAIN // MAIN
gulp.task('js:pgp', ['js:openpgp', 'js:openpgpworker']); gulp.task('moment', ['moment:locales']);
gulp.task('js:moment', ['js:moment:locales']); gulp.task('openpgp', ['js:openpgp', 'js:openpgpworker']);
gulp.task('js', ['js:libs', 'js:min']);
gulp.task('css', ['css:min']);
gulp.task('vendors', ['moment', 'openpgp', 'ckeditor', 'fontastic', 'lightgallery']);
gulp.task('clean', ['js:clean', 'css:clean']);
gulp.task('default', function(callback) {
runSequence('clean', ['js', 'css', 'vendors'], callback);
});
gulp.task('default', ['js:libs', 'js:pgp', 'js:moment', 'js:min', 'css:min', 'ckeditor', 'fontastic', 'lightgallery']);
gulp.task('fast', ['js:app', 'js:admin', 'css:main']); gulp.task('fast', ['js:app', 'js:admin', 'css:main']);
gulp.task('rainloop:start', ['rainloop:copy', 'rainloop:setup']); gulp.task('rainloop:start', ['rainloop:copy', 'rainloop:setup']);

606
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load diff

View file

@ -53,8 +53,7 @@
"babel-loader": "^6.1.0", "babel-loader": "^6.1.0",
"babel-plugin-transform-runtime": "^6.9.0", "babel-plugin-transform-runtime": "^6.9.0",
"babel-preset-es2015": "^6.13.2", "babel-preset-es2015": "^6.13.2",
"babel-preset-es2015-loose": "^7.0.0", "babel-preset-es2016": "^6.11.3",
"babel-preset-es2015-loose-native-modules": "^1.0.0",
"babel-preset-stage-0": "^6.5.0", "babel-preset-stage-0": "^6.5.0",
"babel-runtime": "^6.1.18", "babel-runtime": "^6.1.18",
"es6-promise-polyfill": "^1.2.0", "es6-promise-polyfill": "^1.2.0",
@ -66,9 +65,11 @@
"gulp-concat-util": "^0.5.5", "gulp-concat-util": "^0.5.5",
"gulp-eol": "^0.1.2", "gulp-eol": "^0.1.2",
"gulp-eslint": "^3.0.1", "gulp-eslint": "^3.0.1",
"gulp-header": "^1.8.7", "gulp-filter": "^4.0.0",
"gulp-header": "^1.8.8",
"gulp-if": "^2.0.1", "gulp-if": "^2.0.1",
"gulp-less": "1.3.6", "gulp-ignore": "^2.0.1",
"gulp-less": "^3.1.0",
"gulp-livereload": "~3.8.0", "gulp-livereload": "~3.8.0",
"gulp-notify": "~2.2.0", "gulp-notify": "~2.2.0",
"gulp-plumber": "^1.1.0", "gulp-plumber": "^1.1.0",
@ -105,6 +106,7 @@
"raw-loader": "^0.5.1", "raw-loader": "^0.5.1",
"rifraf": "^2.0.2", "rifraf": "^2.0.2",
"rimraf": "^2.5.4", "rimraf": "^2.5.4",
"run-sequence": "^1.2.2",
"simplestatemanager": "^3.1.3", "simplestatemanager": "^3.1.3",
"tinycon": "github:tommoor/tinycon", "tinycon": "github:tommoor/tinycon",
"underscore": "^1.8.3", "underscore": "^1.8.3",

View file

@ -1947,6 +1947,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
$aResult['StaticLibJsLink'] = $this->StaticPath('js/'.($bAppJsDebug ? '' : 'min/').'libs.js'); $aResult['StaticLibJsLink'] = $this->StaticPath('js/'.($bAppJsDebug ? '' : 'min/').'libs.js');
$aResult['StaticAppJsLink'] = $this->StaticPath('js/'.($bAppJsDebug ? '' : 'min/').($bAdmin ? 'admin' : 'app').'.js'); $aResult['StaticAppJsLink'] = $this->StaticPath('js/'.($bAppJsDebug ? '' : 'min/').($bAdmin ? 'admin' : 'app').'.js');
$aResult['StaticAppJsNextLink'] = $this->StaticPath('js/'.($bAdmin ? 'admin' : 'app').'.next.js'); // todo min
$aResult['StaticEditorJsLink'] = $this->StaticPath('ckeditor/ckeditor.js'); $aResult['StaticEditorJsLink'] = $this->StaticPath('ckeditor/ckeditor.js');
$aResult['EditorDefaultType'] = \in_array($aResult['EditorDefaultType'], array('Plain', 'Html', 'HtmlForced', 'PlainForced')) ? $aResult['EditorDefaultType'] = \in_array($aResult['EditorDefaultType'], array('Plain', 'Html', 'HtmlForced', 'PlainForced')) ?

1
vendors/bootstrap/.code-changed vendored Normal file
View file

@ -0,0 +1 @@

View file

@ -185,7 +185,8 @@
.navbar-static-top .container, .navbar-static-top .container,
.navbar-fixed-top .container, .navbar-fixed-top .container,
.navbar-fixed-bottom .container { .navbar-fixed-bottom .container {
#grid > .core > .span(@gridColumns); // #grid > .core > .span(@gridColumns); // (less 1.3.6 > 3.1.0)
width: (@gridColumnWidth * @gridColumns) + (@gridGutterWidth * (@gridColumns - 1));
} }
// Fixed to top // Fixed to top

1
vendors/inputosaurus/.code-changed vendored Normal file
View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

1
vendors/keymaster/.code-changed vendored Normal file
View file

@ -0,0 +1 @@

125
webpack.config.builder.js Normal file
View file

@ -0,0 +1,125 @@
var
path = require('path'),
webpack = require('webpack'),
devPath = path.resolve(__dirname, 'dev');
module.exports = function(es6) {
return {
entry: es6 ? {
'app.next': __dirname + '/dev/app.jsx',
'admin.next': __dirname + '/dev/admin.jsx'
} : {
'boot': __dirname + '/dev/boot.jsx',
'app': __dirname + '/dev/app.jsx',
'admin': __dirname + '/dev/admin.jsx'
},
output: {
pathinfo: true,
path: __dirname + '/rainloop/v/0.0.0/static/js/',
filename: '[name].js',
publicPath: 'rainloop/v/0.0.0/static/js/'
},
plugins: [
new webpack.optimize.OccurrenceOrderPlugin()
],
resolve: {
modules: [devPath, 'node_modules'],
extensions: ['', '.js', '.jsx'],
alias: {
'Opentip': __dirname + '/dev/External/Opentip.js',
'ko': __dirname + '/dev/External/ko.js'
}
},
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel',
include: [devPath],
query: !es6 ? {
cacheDirectory: true,
presets: [['es2015', {loose: true, modules: false}], 'es2016', 'stage-0'],
plugins: ['transform-runtime']
} : {
cacheDirectory: true,
plugins: [
// es2015
["transform-es2015-template-literals", {loose: true}],
"transform-es2015-literals",
"transform-es2015-function-name",
// ["transform-es2015-arrow-functions")],
"transform-es2015-block-scoped-functions",
// ["transform-es2015-classes", loose],
// "transform-es2015-object-super",
"transform-es2015-shorthand-properties",
"transform-es2015-duplicate-keys",
["transform-es2015-computed-properties", {loose: true}],
["transform-es2015-for-of", {loose: true}],
"transform-es2015-sticky-regex",
"transform-es2015-unicode-regex",
// "check-es2015-constants",
//["transform-es2015-spread", {loose: true}],
// "transform-es2015-parameters",
//["transform-es2015-destructuring", {loose: true}],
// "transform-es2015-block-scoping",
"transform-es2015-typeof-symbol",
// ["transform-regenerator", { async: false, asyncGenerators: false }],
// es2016
"transform-exponentiation-operator",
// stage-0
"transform-do-expressions",
"transform-function-bind",
// stage-1
"transform-class-constructor-call",
"transform-export-extensions",
// stage-2
"transform-class-properties",
"transform-object-rest-spread",
"transform-decorators",
// stage-3
"syntax-trailing-function-commas",
"transform-async-to-generator",
"transform-exponentiation-operator",
// runtime
'transform-runtime'
]
}
},
{
test: /\.(html|css)$/,
loader: 'raw',
include: [devPath]
},
{
test: /\.json$/,
loader: 'json',
include: [devPath]
}
]
},
externals: {
'window': 'window',
'progressJs': 'window.progressJs',
'moment': 'window.moment',
'ifvisible': 'window.ifvisible',
'crossroads': 'window.crossroads',
'hasher': 'window.hasher',
'Jua': 'window.Jua',
'Autolinker': 'window.Autolinker',
'Tinycon': 'window.Tinycon',
'ssm': 'window.ssm',
'key': 'window.key',
'_': 'window._',
'qr': 'window.qr',
'Promise': 'window.Promise',
'$': 'window.jQuery'
}
}
};

View file

@ -1,73 +0,0 @@
var
path = require('path'),
webpack = require('webpack'),
jsLoaderQuery = {
cacheDirectory: true,
presets: ['es2015-loose-native-modules', 'stage-0']
}
;
module.exports = {
entry: {
'boot': __dirname + '/dev/boot.jsx',
'app': __dirname + '/dev/app.jsx',
'admin': __dirname + '/dev/admin.jsx'
},
output: {
pathinfo: true,
path: __dirname + '/rainloop/v/0.0.0/static/js/',
filename: '[name].js',
publicPath: 'rainloop/v/0.0.0/static/js/'
},
// devtool: "#source-map",
plugins: [
// new webpack.optimize.CommonsChunkPlugin('common.js'),
new webpack.optimize.OccurrenceOrderPlugin()
],
resolve: {
modules: [path.resolve(__dirname, 'dev'), 'node_modules'],
extensions: ['', '.js', '.jsx'],
alias: {
'Opentip': __dirname + '/dev/External/Opentip.js',
'ko': __dirname + '/dev/External/ko.js'
}
},
module: {
loaders: [
{
test: /\.(html|css)$/,
loader: 'raw',
exclude: /(node_modules|bower_components|vendors)/
},
{
test: /\.json$/,
loader: 'json',
exclude: /(node_modules|bower_components|vendors)/
},
{
test: /\.jsx$/,
loader: 'babel',
exclude: /(node_modules|bower_components|vendors)/,
query: jsLoaderQuery
}
]
},
externals: {
'window': 'window',
'progressJs': 'window.progressJs',
'moment': 'window.moment',
'ifvisible': 'window.ifvisible',
'crossroads': 'window.crossroads',
'hasher': 'window.hasher',
'Jua': 'window.Jua',
'Autolinker': 'window.Autolinker',
'Tinycon': 'window.Tinycon',
'ssm': 'window.ssm',
'key': 'window.key',
'_': 'window._',
'qr': 'window.qr',
'Promise': 'window.Promise',
'$': 'window.jQuery'
}
};