Last active
March 20, 2019 00:35
-
-
Save AndrejsAbrickis/bc120961f65fe4253130d05da53918ab to your computer and use it in GitHub Desktop.
Migrate from bower to webpack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"directory": "wwwroot/scripts/bower" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "bower-to-webpack", | |
"dependencies": { | |
"datetimepicker": "~2.5.4", | |
"jquery": "~2.1.4", | |
"jquery-ui": "~1.11.2", | |
"lodash": "^4.17.2" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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