Skip to content

Instantly share code, notes, and snippets.

@weilinzung
Forked from AndrejsAbrickis/.bowerrc
Created January 6, 2018 17:03
Show Gist options
  • Save weilinzung/2ab0799eb5c131f656c3f122c4421f2f to your computer and use it in GitHub Desktop.
Save weilinzung/2ab0799eb5c131f656c3f122c4421f2f 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