webpack在build目录中获取svn文件夹

时间:2017-02-16 10:55:17

标签: angular svn webpack angular2-aot

我正在构建一个Angular2应用程序。当我使用ng-tools / webpack加载器时,在最终版本中我在dist存储库中获得了一些svn文件夹。

我怎样才能避免创建svn文件夹?

这是我的webpack.js:         / **          * Webpack常量          * /

    /**
     * Imports
     */
    var webpack = require('webpack');
    var helpers = require('./helpers');


    /**
     * Webpack Plugins
     */
    var CommonsChunkPlugin = webpack.optimize.CommonsChunkPlugin;
    var autoprefixer = require('autoprefixer');
    var HtmlWebpackPlugin = require('html-webpack-plugin');
    var ExtractTextPlugin = require('extract-text-webpack-plugin');
    var CopyWebpackPlugin = require('copy-webpack-plugin');
    var CompressionPlugin = require("compression-webpack-plugin");
    var ngToolsWebpack = require('@ngtools/webpack');

    /**
     * Webpack configuration
     *
     * See: http://webpack.github.io/docs/configuration.html#cli
     */
    module.exports = {

        devtool: 'source-map',

        entry: {

            'polyfills': './src/polyfills.ts',
            'vendor': './src/vendor.ts',
            'app': './src/main.ts' // our angular app

        },

        resolve: {

            modules: [helpers.root('src'), helpers.root('node_modules')],

            extensions: ['.ts', '.js', '.json', '.css', '.scss', '.html'],

            alias: {
                'app': 'src/app',
                'common': 'src/common',
                'jquery.ui':'jquery-ui/jquery-ui.js',
                'moment':'moment/moment.js',
                'jquery':'jquery/dist/jquery.js',
                'fullCalendar ':'fullcalendar/dist/fullcalendar.min.js'
            }

        },

        output: {

            path: helpers.root('dist'),
            publicPath: '/',
            filename: 'js/[name].[hash].js',
            chunkFilename: '[id].[hash].chunk.js'

        },

        module: {

            rules: [

                {
                    test: /\.ts$/,
                    loaders: [ '@ngtools/webpack'],
                    exclude: [/\.(spec|e2e)\.ts$/, /node_modules\/(?!(ng2-.+))/]
                },

                // copy those assets to output
                {test: /\.png|\.jpe?g|\.gif|\.svg|\.woff|\.woff2|\.ttf|\.eot|\.ico|\.svg$/, loader: 'file-loader?name=fonts/[name].[hash].[ext]?'},


                // Support for *.json files.
                {test: /\.json$/, loader: 'json-loader'},

                {
                    test: /\.css$/,
                    exclude: helpers.root('src', 'app'),
                    loader: ExtractTextPlugin.extract({ fallbackLoader: 'style-loader', loader: ['css-loader', 'postcss-loader']})
                },
                {test: /\.css$/, include: helpers.root('src', 'app'), loader: 'raw-loader!postcss-loader'},

                {
                    test: /\.(scss|sass)$/,
                    exclude: helpers.root('src', 'app'),
                    loader:  ExtractTextPlugin.extract({ fallbackLoader: 'style-loader', loader: ['css-loader', 'postcss-loader', 'sass-loader']})
                },
                {test: /\.(scss|sass)$/, exclude: helpers.root('src', 'style'), loader: 'raw-loader!postcss-loader!sass-loader'},

                {test: /\.html$/, loader: 'raw-loader'}

            ],

            noParse: [/.+zone\.js\/dist\/.+/, /.+angular2\/bundles\/.+/, /angular2-polyfills\.js/]

        },

        // Add additional plugins to the compiler.
        //
        // See: http://webpack.github.io/docs/configuration.html#plugins
        plugins: ( function() {

            var plugins = [];

            // see https://github.com/angular/angular/issues/11580
            /*
             plugins.push(new webpack.ContextReplacementPlugin(
             /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
             './src'
             ));
             */
            plugins.push(
                new webpack.LoaderOptionsPlugin({
                    //minimize: true,
                    //debug: false,
                    options: {
                        ts : {
                            'ignoreDiagnostics': [
                                2403, // 2403 -> Subsequent variable declarations
                                2300, // 2300 -> Duplicate identifier
                                2374, // 2374 -> Duplicate number index signature
                                2375, // 2375 -> Duplicate string index signature
                                2502  // 2502 -> Referenced directly or indirectly
                            ]
                        },
                        tslint: {
                            emitErrors: false,
                            failOnHint: false
                        },
                        postcss: [
                            autoprefixer({
                                browsers: ['last 2 version']
                            })
                        ]
                    }
                })
            );

            plugins.push(
                new CommonsChunkPlugin({
                    name: ['vendor', 'polyfills']
                })
            );



            plugins.push(
                // Adding jQuery
                new webpack.ProvidePlugin({
                    $: 'jquery',
                    jQuery: 'jquery',
                    "window.jQuery": 'jquery'
                })
            );

            plugins.push(
                // Adding Moment
                new webpack.ProvidePlugin({
                    moment: 'moment'
                })
            );

            plugins.push(
                // Inject script and link tags into html files
                // Reference: https://github.com/ampedandwired/html-webpack-plugin
                new HtmlWebpackPlugin({
                    template: './src/public/index.html',
                    inject: 'body',
                    chunksSortMode: 'dependency'
                })
            );

            plugins.push(
                // Extract css files
                // Reference: https://github.com/webpack/extract-text-webpack-plugin
                // Disabled when in test mode or not in build mode
                new ExtractTextPlugin('css/[name].[hash].css')
            );

            plugins.push(
                new webpack.optimize.UglifyJsPlugin({
                    compress: {
                        warnings: false
                    },
                    output: {
                        comments: false
                    },
                    sourceMap: false
                }));

            plugins.push(
                // Copy assets from the public folder
                // Reference: https://github.com/kevlened/copy-webpack-plugin
                new CopyWebpackPlugin([{
                    from: helpers.root('src/public')
                }])
            );

            plugins.push(
                new CompressionPlugin({
                    asset: '[path].gz[query]',
                    algorithm: 'gzip',
                    test: /\.js$|\.css$/,
                    threshold: 10240,
                    minRatio: 0.8
                })
            );

            plugins.push(new ngToolsWebpack.AotPlugin({
                tsConfigPath: './tsconfig.aot.test.json',
                entryModule: helpers.root('src/app/app.module#AppModule')
            }));

            return plugins;

        }())

    };

这是tsconfig.aot.test.json:

{
  "compilerOptions": {
    "module": "es2015",
    "moduleResolution": "node",
    "target": "es5",
    "noImplicitAny": false,
    "sourceMap": true,
    "mapRoot": "",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "lib": [
      "es5",
      "dom"
    ],
    "skipLibCheck": true,
    "rootDir": "."
  },
  "angularCompilerOptions": {
    "forkChecker": true,
    "useWebpackText": true
  },
  "exclude": [
    "node_modules",
    "dist",
    "src/custom-typings",
    "typings"
  ]
}

有什么想法吗?

0 个答案:

没有答案