最近私のプロジェクト(Angularjs 1、AdminLTE、SPA)のwebpackに切り替わります。モジュールはwebpackを使用して複製されています
ログインページとログインページがあります。ログインページの は、私が
var path = require('path');
var webpack = require('webpack');
const basepath = 'resources/assets/js/angular/';
module.exports = {
module: {
rules: [
{test: /\.js$/, exclude: /node_modules/, loader: "babel-loader"},
{test: /\.css$/, loader: 'style-loader!css-loader'}
],
noParse: [/moment-with-locales/]
},
devtool: 'source-map',
entry: {
common: ['jquery','bootstrap', 'fastclick', 'sparklines', 'slimscroll','angular','angular-route', 'oclazyload', 'angular-translate', path.resolve(__dirname, `${basepath}../adminlte/adminlte.js`)],
angular: [path.resolve(__dirname, `${basepath}app.js`), path.resolve(__dirname, `${basepath}service.js`)],
login: path.resolve(__dirname, `${basepath}ctrl/login.js`),
logined: ['datatables.net', 'angular-datatables', 'moment', 'ui-select', 'angular-bootstrap-datetimepicker', path.resolve(__dirname, `${basepath}app2.js`)]
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'public/js')
},
resolve: {
alias: {
jquery: "jquery/src/jquery",
moment: "moment/min/moment-with-locales.js"
}
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: ["common"],
minChunks: Infinity
}),
new webpack.ProvidePlugin({
moment: "moment"
})
]
};
のようなので、私はセットアップ私のwebpack.configなどjqueryの、ブートストラップ、角度など、 ログインページの後、私は上記プラスのDataTableのすべてを要求するために、瞬間
を要求します
しかし、上記の設定)が生成さlogined.jsに一瞬のコードの重複につながると私はangular.moduleのモーメント(と呼ばれているので、それがかもしれ をangular.jsます。(実行)app.js 中のSO依存生成された角度に注入される。
私が望むのは、logined.jsに含まれる瞬間であり、私はどこでも(ログインページの後に)それを使うことができます。私はcommon.jsが含まれますログインページの
、 とログインページの後に私はcommon.jsプラスlogined.js
が含まれます、私の考え方が間違っている場合、私は知らない、私はWebPACKのに新しいです。
おかげ