提供没有webpack-dev-server的webpack构建的应用程序

时间:2016-09-14 21:00:21

标签: typescript webpack

我正在尝试从webpack提供TypeScript应用程序,但没有 webpack-dev-server。原因是我希望看到创建的bundle文件而不是从内存中提供应用程序。 下面是我的webpack.config.js。此设置是否足以提供文件? (我已经相互排除了hot: trueHotModuleReplacementPlugin(),因为据说他们不能很好地合作。)

webpack.config.js

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

module.exports = {
    entry: [
         //'webpack-dev-server/client?http://localhost:8888',
         //'webpack/hot/dev-server',
        './app.ts'
    ],
    output: {
        filename: "bundle.js",
        path: path.resolve(__dirname, "dist"),
        publicPath: '/dist'
    },

    devtool: "source-map",

    resolve: {
        extensions: ["", ".webpack.js", ".web.js", ".ts", ".tsx", ".js"]
    },

    module: {
        loaders: [
            { test: /\.tsx?$/, loader: "ts-loader" }
        ],

        preLoaders: [
            { test: /\.js$/, loader: "source-map-loader" }
        ]
    },

    plugins: [
        //new webpack.HotModuleReplacementPlugin(),
        new webpack.NoErrorsPlugin(),
    ],

    devServer: {
        port: 8888,
        hot: true
    }
};

0 个答案:

没有答案