firefly-iii/webpack.mix.js

89 lines
2.4 KiB
JavaScript
Raw Normal View History

let mix = require('laravel-mix');
2019-01-06 06:37:25 -06:00
// mix.autoload({
// jquery: ['$', 'window.jQuery']
// });
//mix.extract(['jquery','chart.js','accounting','chartjs-color-string','chartjs-color','moment','color-name'],'public/v1/js/ff/vendor.js');
mix.extract([],'public/v1/js/ff/vendor.js');
2017-09-09 14:57:24 -05:00
mix.extend(
2019-01-06 06:37:25 -06:00
'firefly_iii',
new class {
constructor() {
this.toCompile = [];
}
2019-01-06 06:37:25 -06:00
/**
* The API name for the component.
*/
name() {
2019-01-06 06:37:25 -06:00
return 'firefly_iii';
}
2019-01-03 12:01:15 -06:00
2019-01-06 06:37:25 -06:00
/**
* Register the component.
*
* @param {*} entry
* @param {string} output
*/
register(entry, output) {
2019-01-03 12:01:15 -06:00
entry = [].concat(entry).map(file => new File(file));
output = new File(output);
2019-01-03 12:01:15 -06:00
this.toCompile.push({ entry, output });
Mix.bundlingJavaScript = true;
}
/**
* Assets to append to the webpack entry.
*
* @param {Entry} entry
*/
webpackEntry(entry) {
this.toCompile.forEach(js => {
entry.addFromOutput(
js.entry.map(file => file.path()),
js.output,
js.entry[0]
);
});
}
2019-01-06 06:37:25 -06:00
dependencies() {
return ["@babel/preset-flow",'@babel/preset-react'];
}
/**
* webpack rules to be appended to the master config.
*/
webpackRules() {
return [].concat([
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
use: [
{
loader: 'babel-loader',
options: this.babelConfig()
}
]
}
]);
}
/**
* Babel config to be merged with Mix's defaults.
*/
babelConfig() {
return {
presets: ["@babel/preset-flow",'@babel/preset-react'],
plugins: [["@babel/plugin-proposal-class-properties"]]
};
}
}()
);
2019-01-06 06:37:25 -06:00
mix.firefly_iii('resources/js/v1/index.js', 'public/v1/js/ff/index.js');