Skip to content

Instantly share code, notes, and snippets.

@AndrejsAbrickis
Last active March 20, 2019 00:35
Show Gist options
  • Save AndrejsAbrickis/bc120961f65fe4253130d05da53918ab to your computer and use it in GitHub Desktop.
Save AndrejsAbrickis/bc120961f65fe4253130d05da53918ab to your computer and use it in GitHub Desktop.
Migrate from bower to webpack
{
"directory": "wwwroot/scripts/bower"
}
const CSS = [
'jquery-ui-dist/jquery-ui.min.css',
'jquery-datetimepicker/jquery.datetimepicker.css'
];
const JS = [
'jquery-ui-dist/jquery-ui.min.js',
'jquery-datetimepicker/jquery.datetimepicker.min.js',
'jquery/dist/jquery.min.js',
'lodash/lodash.min.js'
];
module.exports = [...JS, ...CSS];
{
"name": "bower-to-webpack",
"dependencies": {
"datetimepicker": "~2.5.4",
"jquery": "~2.1.4",
"jquery-ui": "~1.11.2",
"lodash": "^4.17.2"
}
}
{
"name": "bower-to-webpack",
"description": "Easy migration from bower to webpack",
"author": "Andrejs Abrickis",
"dependencies": {
"jquery": "^2.1.4",
"jquery-datetimepicker": "https://github.com/xdan/datetimepicker/archive/2.5.4.tar.gz",
"jquery-ui": "https://github.com/jquery/jquery-ui/archive/1.11.2.tar.gz",
"lodash": "^4.17.2"
},
"devDependencies": {
"copy-webpack-plugin": "^4.0.1"
}
}
const path = require('path');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
// assets.js
const Assets = require('./assets');
module.exports = {
entry: {
app: "./app.js",
},
output: {
path: __dirname + "/wwwroot/scripts",
filename: "[name].bundle.js"
},
plugins: [
new CopyWebpackPlugin(
Assets.map(asset => {
return {
from: path.resolve(__dirname, `./node_modules/${asset}`),
to: path.resolve(__dirname, './wwwroot/scripts/npm')
};
})
)
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment