Closed jsutStacy closed 6 years ago
hello @jsutStacy ,
I'm confused why you use angular cli and have vendor.ts. I guess you are using webpack so
check our webpack.config.json , you may need to add a extract-text-webpack-plugin css-loader
, css-loader
and style-loader
for css test:
install the loader with: npm i style-loader extract-text-webpack-plugin css-loader--save
then in webpack.config.json change the css test with:
{
test: /\.css$/,
loader: ExtractTextPlugin.extract({ fallbackLoader: 'style-loader', loader: 'css-loader?sourceMap' })
},
This meant that I tried both angular-cli and webpack. Anyway, when trying your advice I got the error:
ERROR in ./~/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css Module build failed: ReferenceError: window is not defined ERROR in ./~/bootstrap/dist/css/bootstrap.min.css Module build failed: ReferenceError: window is not defined
@jsutStacy Do you have extract-text-webpack-plugin css-loader
and css-loader
too in your package.json? you need to add theses plugins
yes,
"css-loader": "^0.28.4",
"extract-text-webpack-plugin": "^2.1.2",
how is your webpack.config.json?
it has only these lines:
externals: { jquery: 'jQuery' }
@jsutStacy in webpack.config.js , line 59, from the file you sent from the other topic, you should replace the line with the new one I said above.
I'm closing this issue since you doesn't give some news.
CSS is broken. How to fix it?
angular-cli.json:
"styles": [ "styles.css", "../node_modules/bootstrap/dist/css/bootstrap.min.css", "../node_modules/font-awesome/css/font-awesome.css", "../node_modules/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css"
vendors.ts:
// css files import 'bootstrap/dist/css/bootstrap.min.css'; import 'eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css'; // js files import as $ from 'jquery'; window['jQuery'] = window['$'] = $; import 'bootstrap/dist/js/bootstrap.min.js'; import 'eonasdan-bootstrap-datetimepicker/src/js/bootstrap-datetimepicker.js'; import as moment from 'moment';