将Webpack捆绑包与SystemJS一起使用 客观的
我的目标是用Webpack创建捆绑包,SystemJS可以像Angular 2一样使用它。例如,像Angular 2的将Webpack捆绑包与SystemJS一起使用 客观的,webpack,systemjs,Webpack,Systemjs,我的目标是用Webpack创建捆绑包,SystemJS可以像Angular 2一样使用它。例如,像Angular 2的common.umd.jsbundle 使用网页包很重要 我的处境 我制作了这个捆绑包(使用Webpack) 网页包配置 webpackJsonp是在webpack包中进行代码拆分时所需的函数,由webpack创建 发生错误webpackJsonp未定义,因为在使用webpackJsonp之前未执行定义webpackJsonp的webpack包。我猜你只是在导入核心包 我认为解
common.umd.js
bundle
使用网页包很重要
我的处境
我制作了这个捆绑包(使用Webpack)
网页包配置
webpackJsonp
是在webpack包中进行代码拆分时所需的函数,由webpack创建
发生错误webpackJsonp未定义
,因为在使用webpackJsonp
之前未执行定义webpackJsonp的webpack包。我猜你只是在导入核心包
我认为解决这个问题的方法可能是不进行代码拆分,或者首先导入供应商包(我认为它有
webpackJsonp
的定义)。webpackJsonp
是在webpack包中进行代码拆分时需要的一个函数,它是由webpack创建的
发生错误webpackJsonp未定义
,因为在使用webpackJsonp
之前未执行定义webpackJsonp的webpack包。我猜你只是在导入核心包
我认为解决这个问题的一种方法可能是不进行代码拆分,或者首先导入供应商包(我认为它有webpackJsonp
的定义)
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o=e();for(var n in o)("object"==typeof exports?exports:t)[n]=o[n]}}(this,function(){return webpackJsonp([0],{0:function(t,e,o){"use strict";function n(t){for(var o in t)e.hasOwnProperty(o)||(e[o]=t[o])}n(o(1)),n(o(22))},1:function(t,e,o){"use strict";var n=this&&this.__decorate||function(t,e,o,n){var r,a=arguments.length,f=a<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)f=Reflect.decorate(t,e,o,n);else for(var c=t.length-1;c>=0;c--)(r=t[c])&&(f=(a<3?r(f):a>3?r(e,o,f):r(e,o))||f);return a>3&&f&&Object.defineProperty(e,o,f),f},r=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=o(2),f=function(){function t(){}return t=n([a.Component({selector:"ax-button",template:o(20),styles:[o(21)]}),r("design:paramtypes",[])],t)}();e.AxButton=f},20:function(t,e){t.exports="<button md-raised-button> <ng-content></ng-content> </button>"},21:function(t,e){t.exports=":host > button[md-raised-button] {\n background-color: #28b6f6;\n color: #ffffff;\n z-index: 5;\n text-transform: uppercase;\n box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);\n transition: box-shadow 280ms cubic-bezier(.4, 0, .2, 1);\n will-change: box-shadow; }\n :host > button[md-raised-button]:hover {\n box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12); }\n :host > button[md-raised-button]:focus {\n box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12); }\n :host > button[md-raised-button]:active {\n box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.2), 0 0 0 0 rgba(0, 0, 0, 0.14), 0 0 0 0 rgba(0, 0, 0, 0.12); }\n"},22:function(t,e,o){"use strict";var n=this&&this.__decorate||function(t,e,o,n){var r,a=arguments.length,f=a<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)f=Reflect.decorate(t,e,o,n);else for(var c=t.length-1;c>=0;c--)(r=t[c])&&(f=(a<3?r(f):a>3?r(e,o,f):r(e,o))||f);return a>3&&f&&Object.defineProperty(e,o,f),f},r=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=o(2),f=o(23),c=o(25),i=o(1),s=function(){function t(){}return t=n([a.NgModule({imports:[c.CommonModule,f.MaterialModule.forRoot()],exports:[i.AxButton],declarations:[i.AxButton]}),r("design:paramtypes",[])],t)}();e.AxButtonModule=s}})});
Uncaught ReferenceError: webpackJsonp is not defined
'use strict';
const webpack = require('webpack');
const merge = require('webpack-merge');
let uncompressedPackConfig = {
entry: {
'vendor': './dist/vendor.js',
'core': './dist/core/index.js',
'button': './dist/button/index.js',
'input': './dist/input/index.js'
},
output: {
path: './dist',
filename: '[name]/bundles/[name].umd.js',
libraryTarget: 'umd'
},
resolve: {
extensions: ['', '.js']
},
module: {
loaders: [
{
test: /\.js$/,
loader: 'angular2-template'
},
{
test: /\.html$/,
loader: 'html'
},
{
test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
loader: 'file?name=assets/[name].[hash].[ext]'
},
{
test: /\.css$/,
loader: 'raw'
}
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: ['input', 'button', 'core', 'vendor']
})
]
};
let minifiedPackConfig = merge(uncompressedPackConfig, {
output: {
filename: '[name]/bundles/[name].umd.min.js'
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: { warnings: false }
})
]
});
module.exports = [uncompressedPackConfig, minifiedPackConfig];