Created
September 29, 2020 08:08
-
-
Save tokyosheep/8a214568dd2b4913f5f7ec6e99d957bf to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| "use strict"; | |
| const mode = "development"; | |
| const enabledSourceMap = mode === "development"; | |
| const path = require("path"); | |
| module.exports = { | |
| mode:mode, | |
| devtool:"source-map", | |
| target:"node", | |
| context:path.resolve(__dirname,"src"), | |
| entry:"./js/main.js", | |
| output:{ | |
| path:`${__dirname}/dist`, | |
| filename:"[name]Min.js" | |
| }, | |
| module:{ | |
| rules:[{ | |
| //sassをコンパイル | |
| test:/\.scss/, | |
| use:[ | |
| "style-loader", | |
| { | |
| loader:"css-loader", | |
| options:{ | |
| url:true, | |
| sourceMap:enabledSourceMap, | |
| importLoaders:2 | |
| } | |
| }, | |
| { | |
| loader:"postcss-loader", | |
| options:{ | |
| sourceMap:enabledSourceMap, | |
| postcssOptions:{ | |
| plugins:[ | |
| require("autoprefixer")({ | |
| grid:true | |
| }) | |
| ] | |
| } | |
| } | |
| }, | |
| { | |
| loader:"sass-loader", | |
| options:{ | |
| sourceMap:enabledSourceMap | |
| } | |
| } | |
| ] | |
| } | |
| , | |
| { | |
| //imageファイルもjsにハンドル | |
| test:/\.(gif|png|jpg)$/i, | |
| loader:"url-loader" | |
| }, | |
| { | |
| //例: jsファイルがimportされたらbable-loaderを使ってコンパイル | |
| test:/\.js$/, | |
| use:[ | |
| { | |
| loader:"babel-loader", | |
| options:{ | |
| presets:[ | |
| "@babel/preset-env" | |
| ] | |
| } | |
| } | |
| ] | |
| } | |
| ] | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment