Cant get this to work with webpack. can anyone help out?
vendor.ts file has this.
import 'ng2-datetime';
webpack.config.vendor.js has the following:
`var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var extractCSS = new ExtractTextPlugin('vendor.css');
var isDevelopment = process.env.ASPNETCORE_ENVIRONMENT === 'Development';
module.exports = {
resolve: {
extensions: ['', '.js']
},
module: {
loaders: [
{ test: /.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000' },
{ test: /.css/, loader: extractCSS.extract(['css']) }
]
},
entry: {
vendor: [
'bootstrap',
'bootstrap/dist/css/bootstrap.css',
'style-loader',
'jquery',
'@angular/common',
'@angular/compiler',
'@angular/core',
'@angular/http',
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
'@angular/router',
'moment',
'ng2-bootstrap',
'ng2-datetime',
'ng2-bs3-modal',
'alertifyjs'
]
},
output: {
path: path.join(__dirname, '../wwwroot', 'dist'),
filename: '[name].js',
library: '[name]_[hash]',
},
plugins: [
extractCSS,
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DllPlugin({
path: path.join(__dirname, '../wwwroot', 'dist', '[name]-manifest.json'),
name: '[name]_[hash]'
})
].concat(isDevelopment ? [] : [
new webpack.optimize.UglifyJsPlugin({
compress: { warnings: false },
minimize: true,
mangle: false // Due to https://github.com/angular/angular/issues/6678
})
])
};
`
And my app.module.ts has this.
import { NKDatetime } from 'ng2-datetime/ng2-datetime';
No build error and when i run the app with all this commented out it works fine. But i need the datepickers.
This is the error im getting..
Uncaught Error: Unexpected value 'NKDatetime' declared by the module 'AppModule'(anonymous function) @ compiler.umd.js:14166CompileMetadataResolver.getNgModuleMetadata @ compiler.umd.js:14153RuntimeCompiler._compileComponents @ compiler.umd.js:16777RuntimeCompiler._compileModuleAndComponents @ compiler.umd.js:16715RuntimeCompiler.compileModuleAsync @ compiler.umd.js:16706PlatformRef_._bootstrapModuleWithZone @ core.umd.js:9488PlatformRef_.bootstrapModule @ core.umd.js:9470(anonymous function) @ boot-client.ts:19__webpack_require__ @ bootstrap 4cb6055…:19(anonymous function) @ bootstrap 4cb6055…:39__webpack_require__ @ bootstrap 4cb6055…:19(anonymous function) @ bootstrap 4cb6055…:39(anonymous function) @ bootstrap 4cb6055…:39