如何在汇总中包含typescript的依赖项?

时间:2018-04-03 10:35:39

标签: typescript rollup

我正在使用汇总设置打字稿项目。下面是我到目前为止的汇总配置。

现在我需要包含jQuery。单独使用打字稿我会安装@ types / jquery,那就是它。

然而,

Rollup似乎并没有在它创建的包中包含jQuery,即使tslint没有异议,我在运行时得到$ is not defined。我如何将jquery与js的其余部分一起打包?

import * as fs from 'fs';
import resolve from 'rollup-plugin-node-resolve';
import typescript from 'rollup-plugin-typescript2';
import serve from 'rollup-plugin-serve';
import livereload from 'rollup-plugin-livereload';
import scss from 'rollup-plugin-scss';

import sass from 'node-sass';
import postcss from 'postcss';
import autoprefixer from 'autoprefixer';
import CleanCSS from 'clean-css';

export default {
  input: './src/main.ts',
  output: {
        file: './bundle.js',
        format: 'iife',
        name: 'monoblockPanel'
    },
  plugins: [
        resolve(),
    typescript(),
    scss({
      output: function(styles, styleNodes) {
        postcss([autoprefixer]).process(styles).then(result => {
          result.warnings().forEach(warn => {
            console.warn(warn.toString());
          });
          let minified = new CleanCSS({}).minify(result.css);
          fs.writeFileSync('./styles.css', minified.styles);
        });
      }
    }),
    serve({
            host: '127.0.0.1',
            port: 4201,
            contentBase: '.'
        }),
    livereload()
  ]
}

1 个答案:

答案 0 :(得分:1)

尝试导入

System.Data.SqlClient.SqlException: Subquery returned more than 1 value. 
This is not permitted when the subquery follows =, !=, <, <= , >, >= or when 
the subquery is used as an expression.

它会将import 'jquery`; 添加到全局上下文中并解决您的问题