javascript - Missing dependency when using webpack with bamboo -
i have code use xterm.js build using webpack babel , uglifyjs:
import terminal 'xterm/src/xterm'; import 'xterm/addons/fit/fit'; function terminaldirective($http, config) { return { restrict: 'e', replace: true, scope: { service: '=' }, template: template, link: function($scope, $element, $attrs) { ... if (localstorage.getitem('sessionid')) { $scope.sessionid = localstorage.getitem('sessionid'); $scope.systemid = localstorage.getitem('systemid'); dopost = true; settimeout(function() { init(); }, 100); } ... function init() { xterm = new terminal({cursorblink: true}); xterm.open($element.find('.terminal')[0]); console.log(xterm); xterm.fit(); ... } } }; } terminaldirective.$inject = ['$http', 'config']; export default terminaldirective;
it work fine when run gulp webpack
git bash when run plan on bamboo have task gulp/webpack
or script call node_modules/.bin/gulp.cmd webpack
when open terminal (call init) throw exception r.fit not function (there not errors in bamboo logs). have clue why i've got error , how fix it?
here webpack config file:
var path = require('path'); var webpack = require('webpack'); var htmlwebpackplugin = require('html-webpack-plugin'); module.exports = { //devtool: 'sourcemap', entry: {}, module: { loaders: [ { test: /angular(\.min)?\.js$/, loader: "imports?$=jquery" }, // webpack trow exception trying import addons xterm { test: /\.json$/, loader: 'raw'}, { test: /jquery(\.min)?\.js$/, loader: 'expose?$!expose?jquery' }, { test: /\.js$/, exclude: [/app\/lib/, /node_modules(?!.*xterm)/], loader: 'ng-annotate!babel-loader' }, { test: /\.html$/, loader: 'raw' }, { test: /\.jade$/, loader: 'raw!jade-html' }, { test: /\.styl$/, loader: 'style!css!stylus' }, { test: /\.css$/, loader: 'style!css' } ] }, plugins: [ // injects bundles in index.html instead of wiring manually. // adds hash injected assets don't have problems // cache purging during deployment. new htmlwebpackplugin({ template: 'client/index.html', inject: 'body', hash: true }), // automatically move modules defined outside of application directory vendor bundle. // if using more complicated project structure, consider specify common chunks manually. new webpack.optimize.commonschunkplugin({ name: 'vendor', minchunks: function (module, count) { return module.resource && module.resource.indexof(path.resolve(__dirname, 'client')) === -1; } }) ] };
uglify js added in webpack.dist.config.js
:
var webpack = require('webpack'); var path = require('path'); var config = require('./webpack.config'); config.output = { filename: '[name].bundle.js', publicpath: '', path: path.resolve(__dirname, 'dist') }; config.plugins = config.plugins.concat([ new webpack.optimize.uglifyjsplugin({ mangle: { except: ['$super', '$', 'exports', 'require', 'angular'] } }) ]); module.exports = config;
Comments
Post a Comment