Code Monkey home page Code Monkey logo

Comments (4)

valorkin avatar valorkin commented on May 12, 2024

node npm webpack ts versions?

from ngx-bootstrap.

koblass avatar koblass commented on May 12, 2024

Hi,

I must do something wrong with webpack, because if I use the complete path (../../node_modules/ng2-bootstrap/ng2-bootstrap" in my import statment it's working like a charm. But the ts-loader of webpack is complaining when I use the lib form "ng2-bootstrap/ng2-bootstrap"...

node: v4.2.2
npm: 2.14.7
webpack: 1.12.9
ts-loader: 0.7.2

Here is my webpack conf:

var webpack = require('webpack');
var path = require('path');

var CompressionPlugin = require('compression-webpack-plugin');

/*eslint no-process-env:0, camelcase:0*/
var isProduction = (process.env.NODE_ENV || 'development') === 'production';

var src = 'src/public';
var dest = '/build';
var absDest = path.join(__dirname, dest);

var config = {
    devtool: 'source-map',

    debug: true,
    cache: true,
    context: __dirname,

    resolve: {
        root: __dirname,
        extensions: ['', '.ts', '.js', '.json'],
        alias: {}
    },
    resolveLoader: {
        root: path.join(__dirname, 'node_modules'),
        modulesDirectories: ['node_modules'],
        fallback: path.join(__dirname, "node_modules")
    },

    entry: {
        vendor: [
            // Angular 2 Deps
            '@reactivex/rxjs',
            'zone.js',
            'reflect-metadata',
            'angular2/angular2',
            'angular2/core',
            'angular2/router',
            'angular2/http',
            'ng2-bootstrap/ng2-bootstrap'
        ],

        app: [
            './src/app/bootstrap'
        ]
    },

    output: {
        path: absDest,
        filename: '[name].js',
        sourceMapFilename: '[name].js.map',
        chunkFilename: '[id].chunk.js'
    },

    // our Development Server configs
    devServer: {
        inline: true,
        colors: true,
        historyApiFallback: true,
        contentBase: src,
        publicPath: dest
    },
    module: {
        loaders: [
            // Support for *.json files.
            {test: /\.json$/, loader: 'json'},

            // Support for CSS as raw text
            {test: /\.css$/, loader: 'raw'},

            // support for .html as raw text
            {test: /\.html$/, loader: 'raw'},

            // Support for .ts files
            {
                test: /\.ts$/,
                loader: 'ts',
                exclude: [
                    /\.min\.js$/,
                    /\.spec\.ts$/,
                    /\.e2e\.ts$/
                ]
            }

        ],
        noParse: [
            /rtts_assert\/src\/rtts_assert/
        ]
    },

    plugins: [
        new webpack.optimize.CommonsChunkPlugin({
            name: 'vendor',
            minChunks: Infinity,
            chunks: ['app'],
            filename: 'vendor.js'
        }),
        new webpack.optimize.DedupePlugin({
            __isProduction: isProduction
        }),
        new webpack.optimize.OccurenceOrderPlugin(),
        new webpack.optimize.DedupePlugin()
    ],
    pushPlugins: function () {
        if (!isProduction) {
            return;
        }

        this.plugins.push.apply(this.plugins, [
            //production only
            new webpack.optimize.UglifyJsPlugin({
                compress: {
                    warnings: false,
                    drop_debugger: false
                },
                output: {
                    comments: false
                },
                beautify: false
            }),
            new CompressionPlugin({
                asset: '{file}.gz',
                algorithm: 'gzip',
                regExp: /\.js$|\.html|\.css|.map$/,
                threshold: 10240,
                minRatio: 0.8
            })
        ]);
    },

    stats: {colors: true, reasons: true}
};

config.pushPlugins();

module.exports = config;

Best
Daniel

from ngx-bootstrap.

valorkin avatar valorkin commented on May 12, 2024

typescript is complaining, typescipt version? (global)

from ngx-bootstrap.

koblass avatar koblass commented on May 12, 2024

typescript 1.6.2, local

from ngx-bootstrap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.